From: Ben Beltran Date: Sat, 31 May 2014 17:39:02 +0000 (-0500) Subject: Moves some files around! X-Git-Url: https://git.r.bdr.sh/rbdr/super-polarity/commitdiff_plain/05e4b948df39b47d33067049cf51fd3be7749031?ds=inline Moves some files around! --- diff --git a/SuperPolarity.userprefs b/SuperPolarity.userprefs index beb7836..695350a 100644 --- a/SuperPolarity.userprefs +++ b/SuperPolarity.userprefs @@ -5,8 +5,7 @@ - - + diff --git a/SuperPolarity/Actors/Actor.cs b/SuperPolarity/Actors/Actor.cs index 5e7e482..2c6a895 100644 --- a/SuperPolarity/Actors/Actor.cs +++ b/SuperPolarity/Actors/Actor.cs @@ -14,13 +14,12 @@ namespace SuperPolarity public List Children; - // Graphics / In-Game - protected Texture2D Texture; - protected Vector2 Origin; + // In-Game Properties public bool Active; - public Rectangle Box; - public Vector4 BoxDimensions; - protected Texture2D BoxTexture; + public Rectangle Box; + public Vector4 BoxDimensions; + protected Texture2D BoxTexture; + protected Color Color; // Physical Properties public Vector2 Position; @@ -31,68 +30,58 @@ namespace SuperPolarity // Constraints / Behavior public float MaxVelocity; - protected float AccelerationRate; - public int HP; - protected bool Immortal; + protected float AccelerationRate; public bool Dying; - public int Value; - protected Color Color; public Actor Parent; - public int Width + public virtual int Width { - get { return Texture.Width; } + get { return 0; } } - public int Height + public virtual int Height { - get { return Texture.Height; } + get { return 0; } } public Actor(SuperPolarity newGame) { game = newGame; - BoxDimensions.X = 20; - BoxDimensions.Y = 20; - BoxDimensions.W = 15; - BoxDimensions.Z = 15; + BoxDimensions.X = 20; + BoxDimensions.Y = 20; + BoxDimensions.W = 15; + BoxDimensions.Z = 15; } - public virtual void Initialize(Texture2D texture, Vector2 position) + public virtual void Initialize(Vector2 position) { - Texture = texture; Position = position; Active = true; - Collides = true; + Collides = false; Children = new List(); - Origin = new Vector2(Texture.Width / 2, Texture.Height / 2); Velocity = new Vector2(0, 0); Acceleration = new Vector2(0, 0); MaxVelocity = 5; AccelerationRate = 10; - HP = 1; - Immortal = false; - Dying = false; - Value = 1; - InitBox(); - BoxTexture = new Texture2D(game.GraphicsDevice, 1, 1); - BoxTexture.SetData(new Color[] { Color.White }); + InitBox(); + BoxTexture = new Texture2D(game.GraphicsDevice, 1, 1); + BoxTexture.SetData(new Color[] { Color.White }); Color = Color.White; } - protected void InitBox() - { - Box = new Rectangle((int)(Position.X - BoxDimensions.X), (int)(Position.Y - BoxDimensions.X), (int)(BoxDimensions.X + BoxDimensions.X + BoxDimensions.W), (int)(BoxDimensions.Y + BoxDimensions.Y + BoxDimensions.Z)); - } + protected void InitBox() + { + Box = new Rectangle((int)(Position.X - BoxDimensions.X), (int)(Position.Y - BoxDimensions.X), (int)(BoxDimensions.X + BoxDimensions.X + BoxDimensions.W), (int)(BoxDimensions.Y + BoxDimensions.Y + BoxDimensions.Z)); + } public void AutoDeccelerate(GameTime gameTime) { @@ -154,21 +143,19 @@ namespace SuperPolarity Move(gameTime); ChangeAngle(); CheckOutliers(); - UpdateBox(); + UpdateBox (); } - protected virtual void UpdateBox() - { - Box.X = (int)(Position.X - BoxDimensions.X); - Box.Y = (int)(Position.Y - BoxDimensions.Y); - } + protected virtual void UpdateBox() + { + Box.X = (int)(Position.X - BoxDimensions.X); + Box.Y = (int)(Position.Y - BoxDimensions.Y); + } public virtual void Move(GameTime gameTime) { AutoDeccelerate(gameTime); - var maxVelocity = MaxVelocity; - Velocity.X = Velocity.X + Acceleration.X * (float)gameTime.ElapsedGameTime.TotalSeconds; Velocity.Y = Velocity.Y + Acceleration.Y * (float)gameTime.ElapsedGameTime.TotalSeconds; @@ -220,8 +207,7 @@ namespace SuperPolarity child.Draw(spriteBatch); } - spriteBatch.Draw(Texture, Position, null, Color, Angle, Origin, 1f, SpriteEffects.None, 0f); - //spriteBatch.Draw(BoxTexture, Box, new Color(255, 0, 255, 25)); + //spriteBatch.Draw(BoxTexture, Box, new Color(255, 0, 255, 25)); } void CheckOutliers() @@ -242,18 +228,6 @@ namespace SuperPolarity { } - public void TakeDamage(int amount) - { - if (!Immortal) - { - HP = HP - amount; - if (HP < 0) - { - Die(); - } - } - } - protected virtual void Die() { Dying = true; @@ -261,10 +235,8 @@ namespace SuperPolarity public virtual void CleanUp() { - Texture = null; - BoxTexture = null; - Children = null; - Texture = null; + BoxTexture = null; + Children = null; } } } diff --git a/SuperPolarity/Actors/Bullet.cs b/SuperPolarity/Actors/Bullet.cs index d20289c..13d61c1 100644 --- a/SuperPolarity/Actors/Bullet.cs +++ b/SuperPolarity/Actors/Bullet.cs @@ -7,7 +7,7 @@ using Microsoft.Xna.Framework.Graphics; namespace SuperPolarity { - class Bullet : Actor + class Bullet : GameActor { protected ParticleEngine particleEngine; public int Power; diff --git a/SuperPolarity/Actors/GameActor.cs b/SuperPolarity/Actors/GameActor.cs new file mode 100644 index 0000000..8015ffa --- /dev/null +++ b/SuperPolarity/Actors/GameActor.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + public class GameActor : Actor + { + // Graphics / In-Game + protected Texture2D Texture; + protected Vector2 Origin; + + // Constraints / Behavior + public int HP; + protected bool Immortal; + public int Value; + + public override int Width + { + get { return Texture.Width; } + } + + public override int Height + { + get { return Texture.Height; } + } + + public GameActor(SuperPolarity newGame) + : base(newGame) + { + } + + public virtual void Initialize(Texture2D texture, Vector2 position) + { + base.Initialize (position); + + Texture = texture; + + Collides = true; + + Origin = new Vector2(Texture.Width / 2, Texture.Height / 2); + + HP = 1; + Immortal = false; + + Value = 1; + InitBox (); + } + + public override void Draw(SpriteBatch spriteBatch) + { + base.Draw(spriteBatch); + + spriteBatch.Draw(Texture, Position, null, Color, Angle, Origin, 1f, SpriteEffects.None, 0f); + } + + public override void CleanUp() + { + base.CleanUp (); + Texture = null; + } + + + public void TakeDamage(int amount) + { + if (!Immortal) + { + HP = HP - amount; + if (HP < 0) + { + Die(); + } + } + } + } +} diff --git a/SuperPolarity/Actors/Generators/Generator.cs b/SuperPolarity/Actors/Generators/Generator.cs index dfbc40b..4e2cc3e 100644 --- a/SuperPolarity/Actors/Generators/Generator.cs +++ b/SuperPolarity/Actors/Generators/Generator.cs @@ -9,6 +9,12 @@ namespace SuperPolarity { Collides = false; } + + public override void Draw (Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) + { + base.Draw (spriteBatch); + spriteBatch.Draw(BoxTexture, Box, new Color(255, 0, 255, 25)); + } } } diff --git a/SuperPolarity/Actors/MainShip.cs b/SuperPolarity/Actors/MainShip.cs index bf4f3bb..307bef4 100644 --- a/SuperPolarity/Actors/MainShip.cs +++ b/SuperPolarity/Actors/MainShip.cs @@ -274,11 +274,12 @@ namespace SuperPolarity { particleEngine.Draw(spriteBatch); base.Draw(spriteBatch); + spriteBatch.Draw(BoxTexture, Box, new Color(255, 0, 255, 25)); } public override void Collide(Actor other, Rectangle collision) { - if (other.GetType().IsAssignableFrom(typeof(StandardShip)) && + if (other.GetType().IsAssignableFrom(typeof(StandardShip)) && !Immortal) { Die(); diff --git a/SuperPolarity/Actors/Ship.cs b/SuperPolarity/Actors/Ship.cs index 229f639..5a3f6e5 100644 --- a/SuperPolarity/Actors/Ship.cs +++ b/SuperPolarity/Actors/Ship.cs @@ -7,7 +7,7 @@ using Microsoft.Xna.Framework.Graphics; namespace SuperPolarity { - class Ship : Actor + class Ship : GameActor { public enum Polarity : byte { Negative, Positive, Neutral }; diff --git a/SuperPolarityMac/Actors/Generators/FanGenerator.cs b/SuperPolarityMac/Actors/Generators/FanGenerator.cs deleted file mode 100644 index ea080a7..0000000 --- a/SuperPolarityMac/Actors/Generators/FanGenerator.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace SuperPolarityMac -{ - public class FanGenerator - { - public FanGenerator () - { - } - } -} - diff --git a/SuperPolarityMac/Actors/Generators/Generator.cs b/SuperPolarityMac/Actors/Generators/Generator.cs deleted file mode 100644 index ce8538a..0000000 --- a/SuperPolarityMac/Actors/Generators/Generator.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace SuperPolarityMac -{ - public class Generator - { - public Generator () - { - } - } -} - diff --git a/SuperPolarityMac/Actors/Generators/LineGenerator.cs b/SuperPolarityMac/Actors/Generators/LineGenerator.cs deleted file mode 100644 index b7250cb..0000000 --- a/SuperPolarityMac/Actors/Generators/LineGenerator.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace SuperPolarityMac -{ - public class LineGenerator - { - public LineGenerator () - { - } - } -} - diff --git a/SuperPolarityMac/Actors/Generators/PointGenerator.cs b/SuperPolarityMac/Actors/Generators/PointGenerator.cs deleted file mode 100644 index 16a6e36..0000000 --- a/SuperPolarityMac/Actors/Generators/PointGenerator.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace SuperPolarityMac -{ - public class PointGenerator - { - public PointGenerator () - { - } - } -} - diff --git a/SuperPolarityMac/Actors/Generators/RingGenerator.cs b/SuperPolarityMac/Actors/Generators/RingGenerator.cs deleted file mode 100644 index fe0ab26..0000000 --- a/SuperPolarityMac/Actors/Generators/RingGenerator.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace SuperPolarityMac -{ - public class RingGenerator - { - public RingGenerator () - { - } - } -} - diff --git a/SuperPolarityMac/Actors/Generators/WaveGenerator.cs b/SuperPolarityMac/Actors/Generators/WaveGenerator.cs deleted file mode 100644 index 8249bb0..0000000 --- a/SuperPolarityMac/Actors/Generators/WaveGenerator.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace SuperPolarityMac -{ - public class WaveGenerator - { - public WaveGenerator () - { - } - } -} - diff --git a/SuperPolarityMac/SuperPolarityMac.csproj b/SuperPolarityMac/SuperPolarityMac.csproj index caf0a51..740745a 100644 --- a/SuperPolarityMac/SuperPolarityMac.csproj +++ b/SuperPolarityMac/SuperPolarityMac.csproj @@ -11,6 +11,7 @@ SuperPolarityMac Resources SuperPolarityMac + True true @@ -157,6 +158,27 @@ Properties\AssemblyInfo.cs + + Actors\Generators\FanGenerator.cs + + + Actors\Generators\Generator.cs + + + Actors\Generators\LineGenerator.cs + + + Actors\Generators\PointGenerator.cs + + + Actors\Generators\RingGenerator.cs + + + Actors\Generators\WaveGenerator.cs + + + Actors\GameActor.cs + @@ -190,6 +212,7 @@ + diff --git a/SuperPolarityMac/SuperPolarityMac.userprefs b/SuperPolarityMac/SuperPolarityMac.userprefs index a83111a..9c0cef4 100644 --- a/SuperPolarityMac/SuperPolarityMac.userprefs +++ b/SuperPolarityMac/SuperPolarityMac.userprefs @@ -1,9 +1,16 @@ - + - + - - + + + + + + + + +