]> git.r.bdr.sh - rbdr/super-polarity/commitdiff
I think bullets come out now.
authorBen Beltran <redacted>
Wed, 13 Nov 2013 04:40:29 +0000 (22:40 -0600)
committerBen Beltran <redacted>
Wed, 13 Nov 2013 04:40:29 +0000 (22:40 -0600)
21 files changed:
Super Polarity Content/Super Polarity ContentContent/Graphics/square.png [new file with mode: 0644]
Super Polarity Content/Super Polarity ContentContent/Super Polarity ContentContent.contentproj
Super Polarity/ActorFactory.cs
Super Polarity/ActorManager.cs
Super Polarity/Actors/Actor.cs
Super Polarity/Actors/Bullet.cs [new file with mode: 0644]
Super Polarity/Actors/MainShip.cs
Super Polarity/Actors/Ship.cs
Super Polarity/Content/Graphics/square.xnb [new file with mode: 0644]
Super Polarity/InputController.cs
Super Polarity/ParticleEffectFactory.cs [new file with mode: 0644]
Super Polarity/ParticleEngine.cs
Super Polarity/Renderer.cs [new file with mode: 0644]
Super Polarity/Super Polarity.csproj
Super Polarity/SuperPolarity.cs
Super Polarity/bin/WindowsGL/Debug/Super Polarity.exe
Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb
Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Super Polarity/obj/x86/Debug/Super Polarity.csproj.FileListAbsolute.txt
Super Polarity/obj/x86/Debug/Super Polarity.exe
Super Polarity/obj/x86/Debug/Super Polarity.pdb

diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/square.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/square.png
new file mode 100644 (file)
index 0000000..960c50a
Binary files /dev/null and b/Super Polarity Content/Super Polarity ContentContent/Graphics/square.png differ
index f86c49eb532010a2fbbbab09b0145f5c315536ed..1aedf5318370e23b9e9c15db99eb480f880642b8 100644 (file)
     </Compile>
   </ItemGroup>
   <ItemGroup>
     </Compile>
   </ItemGroup>
   <ItemGroup>
+    <Folder Include="Fonts\" />
     <Folder Include="Sound\" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Sound\" />
   </ItemGroup>
   <ItemGroup>
       <Processor>TextureProcessor</Processor>
     </Compile>
   </ItemGroup>
       <Processor>TextureProcessor</Processor>
     </Compile>
   </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Graphics\square.png">
+      <Name>square</Name>
+      <Importer>TextureImporter</Importer>
+      <Processor>TextureProcessor</Processor>
+    </Compile>
+  </ItemGroup>
   <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" />
   <!--
       To modify your build process, add your task inside one of the targets below and uncomment it. 
   <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" />
   <!--
       To modify your build process, add your task inside one of the targets below and uncomment it. 
index 3e2f80bb1cdced76b049df22a2108044d85eb0e7..4ebbb4c44afdb96894f89b3f58c498d97621b8c5 100644 (file)
@@ -52,5 +52,18 @@ namespace SuperPolarity
         {
             ActorFactory.Game = game;
         }
         {
             ActorFactory.Game = game;
         }
+
+        internal static Bullet CreateBullet(Vector2 position, float angle)
+        {
+            Bullet bullet = new Bullet(Game);
+
+            bullet.Initialize(Game.Content.Load<Texture2D>("Graphics\\square"), position);
+
+            bullet.Angle = angle;
+
+            ActorManager.CheckIn(bullet);
+
+            return bullet;
+        }
     }
 }
     }
 }
index 39ae336f313121ea28964ea9854190a44e3a7009..1b4ef96c6e1c506a690a0b6c9899e782879d0287 100644 (file)
@@ -9,10 +9,14 @@ namespace SuperPolarity
 {
     static class ActorManager
     {
 {
     static class ActorManager
     {
+
+        static Game Game;
+        static int OutlierBounds;
         static List<Actor> Actors;
 
         static ActorManager()
         {
         static List<Actor> Actors;
 
         static ActorManager()
         {
+            OutlierBounds = 100;
             Actors = new List<Actor>();
         }
 
             Actors = new List<Actor>();
         }
 
@@ -29,6 +33,7 @@ namespace SuperPolarity
         static public void Update(GameTime gameTime) 
         {
             CheckActors();
         static public void Update(GameTime gameTime) 
         {
             CheckActors();
+            CheckOutliers();
             foreach (Actor actor in Actors)
             {
                 actor.Update(gameTime);
             foreach (Actor actor in Actors)
             {
                 actor.Update(gameTime);
@@ -74,13 +79,33 @@ namespace SuperPolarity
                 var dx = other.Position.X - actor.Position.X;
                 var linearDistance = Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2));
                 var angle = (float) Math.Atan2(dy, dx);
                 var dx = other.Position.X - actor.Position.X;
                 var linearDistance = Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2));
                 var angle = (float) Math.Atan2(dy, dx);
+                var otherAngle = (float)Math.Atan2(-dy, -dx);
 
                 if (linearDistance < actor.MagneticRadius || linearDistance < other.MagneticRadius)
                 {
                     actor.Magnetize(other, (float)linearDistance, angle);
 
                 if (linearDistance < actor.MagneticRadius || linearDistance < other.MagneticRadius)
                 {
                     actor.Magnetize(other, (float)linearDistance, angle);
-                    other.Magnetize(actor, (float)linearDistance, 90 - angle);
+                    other.Magnetize(actor, (float)linearDistance, otherAngle);
                 }
             }
         }
                 }
             }
         }
+
+        static void CheckOutliers()
+        {
+            for (var i = Actors.Count; i > 0; i--)
+            {
+                var actor = Actors[i-1];
+                if (actor.Position.X < -OutlierBounds || actor.Position.Y < -OutlierBounds ||
+                    actor.Position.X > Game.GraphicsDevice.Viewport.Width + OutlierBounds ||
+                    actor.Position.Y > Game.GraphicsDevice.Viewport.Height + OutlierBounds)
+                {
+                    CheckOut(actor);
+                }
+            }
+        }
+
+        internal static void SetGame(Game game)
+        {
+            Game = game;
+        }
     }
 }
     }
 }
index 4351bf22dd71c4b43ad256347135317dc1a7f61b..588ff1421875dcf45c45055afeed61b3c0eb432f 100644 (file)
@@ -12,6 +12,8 @@ namespace SuperPolarity
     {
         protected Game game;
 
     {
         protected Game game;
 
+        public List<Actor> Children;
+
         // Graphics / In-Game
         protected Texture2D Texture;
         protected Vector2 Origin;
         // Graphics / In-Game
         protected Texture2D Texture;
         protected Vector2 Origin;
@@ -21,7 +23,7 @@ namespace SuperPolarity
         public Vector2 Position;
         protected Vector2 Velocity;
         protected Vector2 Acceleration;
         public Vector2 Position;
         protected Vector2 Velocity;
         protected Vector2 Acceleration;
-        protected float Angle;
+        public float Angle;
 
         // Constraints / Behavior
         protected float MaxVelocity;
 
         // Constraints / Behavior
         protected float MaxVelocity;
@@ -48,6 +50,8 @@ namespace SuperPolarity
             Position = position;
             Active = true;
 
             Position = position;
             Active = true;
 
+            Children = new List<Actor>();
+
             Origin = new Vector2(Texture.Width / 2, Texture.Height / 2);
             Velocity = new Vector2(0, 0);
             Acceleration = new Vector2(0, 0);
             Origin = new Vector2(Texture.Width / 2, Texture.Height / 2);
             Velocity = new Vector2(0, 0);
             Acceleration = new Vector2(0, 0);
@@ -115,12 +119,15 @@ namespace SuperPolarity
         {
             Move(gameTime);
             ChangeAngle();
         {
             Move(gameTime);
             ChangeAngle();
+            CheckOutliers();
         }
 
         }
 
-        public void Move(GameTime gameTime)
+        public virtual void Move(GameTime gameTime)
         {
             AutoDeccelerate(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;
 
             Velocity.X = Velocity.X + Acceleration.X * (float)gameTime.ElapsedGameTime.TotalSeconds;
             Velocity.Y = Velocity.Y + Acceleration.Y * (float)gameTime.ElapsedGameTime.TotalSeconds;
 
@@ -155,7 +162,26 @@ namespace SuperPolarity
 
         public virtual void Draw(SpriteBatch spriteBatch)
         {
 
         public virtual void Draw(SpriteBatch spriteBatch)
         {
+            foreach (Actor child in Children)
+            {
+                child.Draw(spriteBatch);
+            }
+
             spriteBatch.Draw(Texture, Position, null, Color.White, Angle, Origin, 1f, SpriteEffects.None, 0f);
         }
             spriteBatch.Draw(Texture, Position, null, Color.White, Angle, Origin, 1f, SpriteEffects.None, 0f);
         }
+
+        void CheckOutliers()
+        {
+            for (var i = Children.Count; i > 0; i--)
+            {
+                var actor = Children[i - 1];
+                if (actor.Position.X < -SuperPolarity.OutlierBounds || actor.Position.Y < -SuperPolarity.OutlierBounds ||
+                    actor.Position.X > game.GraphicsDevice.Viewport.Width + SuperPolarity.OutlierBounds ||
+                    actor.Position.Y > game.GraphicsDevice.Viewport.Height + SuperPolarity.OutlierBounds)
+                {
+                    Children.Remove(actor);
+                }
+            }
+        }
     }
 }
     }
 }
diff --git a/Super Polarity/Actors/Bullet.cs b/Super Polarity/Actors/Bullet.cs
new file mode 100644 (file)
index 0000000..6862e69
--- /dev/null
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace SuperPolarity
+{
+    class Bullet : Actor
+    {
+        protected ParticleEngine particleEngine;
+
+        public Bullet(Game newGame)
+            : base(newGame)
+        {
+        }
+
+        ~Bullet()
+        {
+            particleEngine = null;
+        }
+
+        public override void Initialize(Texture2D texture, Vector2 position)
+        {
+            base.Initialize(texture, position);
+            particleEngine = ParticleEffectFactory.CreateBullet(position);
+        }
+
+        public override void Update(GameTime gameTime)
+        {
+            Velocity.X = (float)(MaxVelocity * Math.Cos(Angle));
+            Velocity.Y = (float)(MaxVelocity * Math.Sin(Angle));
+
+            Position += Velocity;
+
+            particleEngine.Update();
+            particleEngine.EmitterLocation = Position;
+        }
+
+        public override void Draw(SpriteBatch spriteBatch)
+        {
+            base.Draw(spriteBatch);
+            particleEngine.Draw(spriteBatch);
+        }
+    }
+}
index 851c658da25de66ca25adc228c93980580eb1db0..1f4f22ac2128d0e194ef025f370bb90b01588ca7 100644 (file)
@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using System.Threading;
 using Microsoft.Xna.Framework;
 using Microsoft.Xna.Framework.Content;
 using Microsoft.Xna.Framework.Graphics;
 using Microsoft.Xna.Framework;
 using Microsoft.Xna.Framework.Content;
 using Microsoft.Xna.Framework.Graphics;
@@ -10,36 +11,40 @@ namespace SuperPolarity
 {
     class MainShip : Ship
     {
 {
     class MainShip : Ship
     {
-        
-        uint Multiplier;
-        uint Lives;
-        uint Score;
+
+        public static Color BlueColor;
+        public static Color RedColor;
+
         ParticleEngine particleEngine;
 
         ParticleEngine particleEngine;
 
+        protected bool Shooting;
+        protected int ShotCooldown;
+
         public MainShip(Game newGame) : base(newGame) {}
 
         public MainShip(Game newGame) : base(newGame) {}
 
+        ~MainShip()
+        {
+            particleEngine = null;
+        }
+
         public override void Initialize(Texture2D texture, Vector2 position)
         {
             base.Initialize(texture, position);
 
         public override void Initialize(Texture2D texture, Vector2 position)
         {
             base.Initialize(texture, position);
 
+            MainShip.BlueColor = new Color(230, 244, 249);
+            MainShip.RedColor = new Color(255, 234, 241);
+
             InitParticleEngine();
             SetPolarity(Polarity.Positive);
 
             InitParticleEngine();
             SetPolarity(Polarity.Positive);
 
-            Multiplier = 1;
-            Lives = 3;
-            Score = 0;
+            ShotCooldown = 50;
 
             BindInput();
         }
 
         void InitParticleEngine()
         {
 
             BindInput();
         }
 
         void InitParticleEngine()
         {
-            List<Texture2D> texturesList = new List<Texture2D>();
-            texturesList.Add(game.Content.Load<Texture2D>("Graphics\\circle"));
-            texturesList.Add(game.Content.Load<Texture2D>("Graphics\\diamond"));
-            texturesList.Add(game.Content.Load<Texture2D>("Graphics\\star"));
-
-            particleEngine = new ParticleEngine(texturesList, Position);
+            particleEngine = ParticleEffectFactory.CreatePolarCircle(Position);
         }
 
         void BindInput()
         }
 
         void BindInput()
@@ -47,6 +52,20 @@ namespace SuperPolarity
             InputController.Bind("moveX", HandleHorizontalMovement);
             InputController.Bind("moveY", HandleVerticalMovement);
             InputController.Bind("changePolarity", HandleChangePolarity);
             InputController.Bind("moveX", HandleHorizontalMovement);
             InputController.Bind("moveY", HandleVerticalMovement);
             InputController.Bind("changePolarity", HandleChangePolarity);
+            InputController.Bind("shoot", HandleShot);
+        }
+
+        protected void HandleShot(float value)
+        {
+            Children.Add(ActorFactory.CreateBullet(Position, Angle));
+            Shooting = true;
+            Timer t = new Timer(new TimerCallback(UnlockShot));
+            t.Change(ShotCooldown, Timeout.Infinite);
+        }
+
+        protected void UnlockShot(object state)
+        {
+            InputController.Unlock("shoot");
         }
 
         protected void HandleChangePolarity(float value)
         }
 
         protected void HandleChangePolarity(float value)
@@ -90,11 +109,11 @@ namespace SuperPolarity
         {
             if (polarity == Polarity.Positive)
             {
         {
             if (polarity == Polarity.Positive)
             {
-                particleEngine.Color = Color.Red;
+                particleEngine.Color = MainShip.RedColor;
             }
             else if (polarity == Polarity.Negative)
             {
             }
             else if (polarity == Polarity.Negative)
             {
-                particleEngine.Color = Color.Blue;
+                particleEngine.Color = MainShip.BlueColor;
             }
             else
             {
             }
             else
             {
@@ -108,6 +127,35 @@ namespace SuperPolarity
             particleEngine.EmitterLocation = Position;
             particleEngine.Update();
             ConstrainToEdges();
             particleEngine.EmitterLocation = Position;
             particleEngine.Update();
             ConstrainToEdges();
+            Shooting = false;
+        }
+
+        public override void Move(GameTime gameTime)
+        {
+            base.Move(gameTime);
+
+            if (Shooting)
+            {
+                if (Velocity.X > ActVelocity)
+                {
+                    Velocity.X = ActVelocity;
+                }
+
+                if (Velocity.X < -ActVelocity)
+                {
+                    Velocity.X = -ActVelocity;
+                }
+
+                if (Velocity.Y > ActVelocity)
+                {
+                    Velocity.Y = ActVelocity;
+                }
+
+                if (Velocity.Y < -ActVelocity)
+                {
+                    Velocity.Y = -ActVelocity;
+                }
+            }
         }
 
         public override void Magnetize(Ship ship, float distance, float angle)
         }
 
         public override void Magnetize(Ship ship, float distance, float angle)
index 502c22ed0b21efa8ea099a14d08e8f27be9a932c..b4706ac41670e8c42180d99b73962e716336be4f 100644 (file)
@@ -27,7 +27,7 @@ namespace SuperPolarity
             RepelRadius = 100;
 
             FleeVelocity = 5;
             RepelRadius = 100;
 
             FleeVelocity = 5;
-            ActVelocity = 3;
+            ActVelocity = 2;
             ChargeVelocity = 1.5f;
             CurrentPolarity = Polarity.Neutral;
             Magnetizing = false;
             ChargeVelocity = 1.5f;
             CurrentPolarity = Polarity.Neutral;
             Magnetizing = false;
diff --git a/Super Polarity/Content/Graphics/square.xnb b/Super Polarity/Content/Graphics/square.xnb
new file mode 100644 (file)
index 0000000..5a88d89
Binary files /dev/null and b/Super Polarity/Content/Graphics/square.xnb differ
index ad07717b11c279778e35b72a1cde538692ff7081..79bd0391bedb6e0b077365021dc57ce5a7022f09 100644 (file)
@@ -88,8 +88,8 @@ namespace SuperPolarity
                     {
                         if (!BlockedKeys.Contains(entry.Key))
                         {
                     {
                         if (!BlockedKeys.Contains(entry.Key))
                         {
-                            Dispatch(entry.Key, 1);
                             BlockedKeys.Add(entry.Key);
                             BlockedKeys.Add(entry.Key);
+                            Dispatch(entry.Key, 1);
                         }
                         keyFired = true;
                         break;
                         }
                         keyFired = true;
                         break;
@@ -111,8 +111,8 @@ namespace SuperPolarity
                     {
                         if (!BlockedButtons.Contains(entry.Key))
                         {
                     {
                         if (!BlockedButtons.Contains(entry.Key))
                         {
-                            Dispatch(entry.Key, 1);
                             BlockedButtons.Add(entry.Key);
                             BlockedButtons.Add(entry.Key);
+                            Dispatch(entry.Key, 1);
                         }
                         keyFired = true;
                         break;
                         }
                         keyFired = true;
                         break;
@@ -192,5 +192,11 @@ namespace SuperPolarity
                 method(value);
             }
         }
                 method(value);
             }
         }
+
+        public static void Unlock(string eventName)
+        {
+            BlockedButtons.Remove(eventName);
+            BlockedKeys.Remove(eventName);
+        }
     }
 }
     }
 }
diff --git a/Super Polarity/ParticleEffectFactory.cs b/Super Polarity/ParticleEffectFactory.cs
new file mode 100644 (file)
index 0000000..0cd9ed3
--- /dev/null
@@ -0,0 +1,66 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace SuperPolarity
+{
+    static class ParticleEffectFactory
+    {
+        static Game Game;
+        static Random random;
+
+        static ParticleEffectFactory()
+        {
+            random = new Random();
+        }
+
+        public static ParticleEngine CreatePolarCircle(Vector2 location)
+        {
+            List<Texture2D> texturesList = new List<Texture2D>();
+
+            //texturesList.Add(Game.Content.Load<Texture2D>("Graphics\\circle"));
+            texturesList.Add(Game.Content.Load<Texture2D>("Graphics\\diamond"));
+            texturesList.Add(Game.Content.Load<Texture2D>("Graphics\\square"));
+
+            ParticleEngine particleEngine = new ParticleEngine(texturesList, location);
+
+            particleEngine.Color = new Color(239, 203, 204);
+            particleEngine.TTL = 10;
+            particleEngine.TTLRandomFactor = 5;
+            particleEngine.ScatterFactor = 40;
+            particleEngine.ParticleCount = 50;
+            particleEngine.StretchFactor = 2.8f;
+
+
+            return particleEngine;
+        }
+
+        public static ParticleEngine CreateBullet(Vector2 location)
+        {
+            List<Texture2D> texturesList = new List<Texture2D>();
+
+            texturesList.Add(Game.Content.Load<Texture2D>("Graphics\\circle"));
+            //texturesList.Add(Game.Content.Load<Texture2D>("Graphics\\diamond"));
+            texturesList.Add(Game.Content.Load<Texture2D>("Graphics\\square"));
+
+            ParticleEngine particleEngine = new ParticleEngine(texturesList, location);
+
+            particleEngine.Color = Color.Gray;
+            particleEngine.TTL = 5;
+            particleEngine.TTLRandomFactor = 5;
+            particleEngine.ScatterFactor = 5;
+            particleEngine.ParticleCount = 10;
+            particleEngine.StretchFactor = 1;
+
+            return particleEngine;
+        }
+
+        internal static void SetGame(Game game)
+        {
+            ParticleEffectFactory.Game = game;
+        }
+    }
+}
index 0fced25f179873533b230e709d03e6e11c4c748a..51188ae3815e1c90c66f34777c31c90063d90d2c 100644 (file)
@@ -11,7 +11,12 @@ namespace SuperPolarity
     {
         private Random random;
         public Vector2 EmitterLocation { get; set; }
     {
         private Random random;
         public Vector2 EmitterLocation { get; set; }
-        public Color Color;
+        public Color Color; //TODO: Color list for random colors.
+        public int TTL;
+        public int TTLRandomFactor;
+        public int ScatterFactor;
+        public int ParticleCount;
+        public float StretchFactor;
         private List<Particle> particles;
         private List<Texture2D> textures;
 
         private List<Particle> particles;
         private List<Texture2D> textures;
 
@@ -22,6 +27,9 @@ namespace SuperPolarity
             this.particles = new List<Particle>();
             random = new Random();
             Color = Color.Red;
             this.particles = new List<Particle>();
             random = new Random();
             Color = Color.Red;
+            TTL = 20;
+            TTLRandomFactor = 40;
+            StretchFactor = 1;
         }
 
         private Particle GenerateNewParticle()
         }
 
         private Particle GenerateNewParticle()
@@ -31,12 +39,16 @@ namespace SuperPolarity
             Vector2 velocity = new Vector2(
                 1f * (float)(random.NextDouble() * 2 - 1),
                 1f * (float)(random.NextDouble() * 2 - 1));
             Vector2 velocity = new Vector2(
                 1f * (float)(random.NextDouble() * 2 - 1),
                 1f * (float)(random.NextDouble() * 2 - 1));
+
             float angle = 0;
             float angularVelocity = 0.1f * (float)(random.NextDouble() * 2 - 1);
             Color color = Color;
             float angle = 0;
             float angularVelocity = 0.1f * (float)(random.NextDouble() * 2 - 1);
             Color color = Color;
-            float size = (float)random.NextDouble();
+            float size = (float)random.NextDouble() * StretchFactor;
+
+            position.X += random.Next(-ScatterFactor, ScatterFactor);
+            position.Y += random.Next(-ScatterFactor, ScatterFactor);
 
 
-            int ttl = 20 + random.Next(40);
+            int ttl = TTL + random.Next(TTLRandomFactor);
 
             return new Particle(texture, position, velocity, angle, angularVelocity, color, size, ttl);
         }
 
             return new Particle(texture, position, velocity, angle, angularVelocity, color, size, ttl);
         }
diff --git a/Super Polarity/Renderer.cs b/Super Polarity/Renderer.cs
new file mode 100644 (file)
index 0000000..2f5c5aa
--- /dev/null
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace SuperPolarity
+{
+    class Renderer
+    {
+        
+        static List<Actor> Actors;
+
+        static Renderer()
+        {
+            Actors = new List<Actor>();
+        }
+
+        static public void CheckIn(Actor actor)
+        {
+            Actors.Add(actor);
+        }
+
+        static public void CheckOut(Actor actor)
+        {
+            Actors.Remove(actor);
+        }
+
+        static public void Draw(SpriteBatch spriteBatch)
+        {
+            foreach (Actor actor in Actors)
+            {
+                actor.Draw(spriteBatch);
+            }
+        }
+    }
+}
index 4ed5c42072b6cb4f8a6322f21c4aa95679774e5e..193eddea88eeea932f7ed4989cece7d5fdfb0c5c 100644 (file)
     <Compile Include="ActorFactory.cs" />
     <Compile Include="ActorManager.cs" />
     <Compile Include="Actors\StandardShip.cs" />
     <Compile Include="ActorFactory.cs" />
     <Compile Include="ActorManager.cs" />
     <Compile Include="Actors\StandardShip.cs" />
+    <Compile Include="Actors\Bullet.cs" />
     <Compile Include="InputController.cs" />
     <Compile Include="Actors\MainShip.cs" />
     <Compile Include="Particle.cs" />
     <Compile Include="InputController.cs" />
     <Compile Include="Actors\MainShip.cs" />
     <Compile Include="Particle.cs" />
+    <Compile Include="ParticleEffectFactory.cs" />
     <Compile Include="ParticleEngine.cs" />
     <Compile Include="Actors\Actor.cs" />
     <Compile Include="Actors\Ship.cs" />
     <Compile Include="ParticleEngine.cs" />
     <Compile Include="Actors\Actor.cs" />
     <Compile Include="Actors\Ship.cs" />
+    <Compile Include="Renderer.cs" />
     <Compile Include="SuperPolarity.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="SuperPolarity.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <None Include="Content\Graphics\positive-supercruiser.xnb">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
     <None Include="Content\Graphics\positive-supercruiser.xnb">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
+    <None Include="Content\Graphics\square.xnb">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
     <None Include="Content\Graphics\star.xnb">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
     <None Include="Content\Graphics\star.xnb">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
index b590079bf248f065530b48775c10083b6013c8c4..21d1ed444af2f0cec8fcdfaa2e2c3d8005471fdc 100644 (file)
@@ -20,6 +20,8 @@ namespace SuperPolarity
         public static GraphicsDeviceManager graphics;
         SpriteBatch spriteBatch;
 
         public static GraphicsDeviceManager graphics;
         SpriteBatch spriteBatch;
 
+        public static int OutlierBounds;
+
         public SuperPolarity()
             : base()
         {
         public SuperPolarity()
             : base()
         {
@@ -27,6 +29,8 @@ namespace SuperPolarity
             SuperPolarity.graphics.PreferMultiSampling = true;
             Content.RootDirectory = "Content";
             ActorFactory.SetGame(this);
             SuperPolarity.graphics.PreferMultiSampling = true;
             Content.RootDirectory = "Content";
             ActorFactory.SetGame(this);
+            ParticleEffectFactory.SetGame(this);
+            ActorManager.SetGame(this);
         }
 
         /// <summary>
         }
 
         /// <summary>
@@ -39,6 +43,8 @@ namespace SuperPolarity
         {
             base.Initialize();
 
         {
             base.Initialize();
 
+            OutlierBounds = 100;
+
             InputController.RegisterEventForButton("changePolarity", Buttons.A);
             InputController.RegisterEventForKey("changePolarity", Keys.Z);
 
             InputController.RegisterEventForButton("changePolarity", Buttons.A);
             InputController.RegisterEventForKey("changePolarity", Keys.Z);
 
@@ -57,9 +63,9 @@ namespace SuperPolarity
 
             Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
 
 
             Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
 
-            ActorFactory.CreateShip(Ship.Polarity.Positive, new Vector2(200, 200));
-            ActorFactory.CreateShip(Ship.Polarity.Negative, new Vector2(400, 200));
-            ActorFactory.CreateMainShip(playerPosition);
+            Renderer.CheckIn(ActorFactory.CreateMainShip(playerPosition));
+            Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Positive, new Vector2(200, 200)));
+            Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Negative, new Vector2(400, 200)));
         }
 
         /// <summary>
         }
 
         /// <summary>
@@ -99,7 +105,7 @@ namespace SuperPolarity
 
             spriteBatch.Begin();
 
 
             spriteBatch.Begin();
 
-            ActorManager.Draw(spriteBatch);
+            Renderer.Draw(spriteBatch);
 
             spriteBatch.End();
 
 
             spriteBatch.End();
 
index 927901879b585e6fb4fa61cd3fa7219d0aa79b15..906274f5644a023e21bcb7dddb31e4f2e94c969f 100644 (file)
Binary files a/Super Polarity/bin/WindowsGL/Debug/Super Polarity.exe and b/Super Polarity/bin/WindowsGL/Debug/Super Polarity.exe differ
index d363b2b7b87b6bca97bcb80f8ab390c40b4a49bc..837ce9bdcdba6f095b00a21787f473451ecb1154 100644 (file)
Binary files a/Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb and b/Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb differ
index 907615f4ae30b0cfa8778612d040260b9b776e62..c87641f3b82f75eea92cbecce36800f66c566e88 100644 (file)
Binary files a/Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ
index 99c9bb477220e5045d5bb9b25a527d3bea87467c..aa6ffb369800bfe2c633d22dd1f6123fb40aabf7 100644 (file)
@@ -27,3 +27,4 @@ C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarit
 C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\diamond.xnb
 C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\star.xnb
 C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\negative-ship.xnb
 C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\diamond.xnb
 C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\star.xnb
 C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\negative-ship.xnb
+C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\square.xnb
index 927901879b585e6fb4fa61cd3fa7219d0aa79b15..906274f5644a023e21bcb7dddb31e4f2e94c969f 100644 (file)
Binary files a/Super Polarity/obj/x86/Debug/Super Polarity.exe and b/Super Polarity/obj/x86/Debug/Super Polarity.exe differ
index d363b2b7b87b6bca97bcb80f8ab390c40b4a49bc..837ce9bdcdba6f095b00a21787f473451ecb1154 100644 (file)
Binary files a/Super Polarity/obj/x86/Debug/Super Polarity.pdb and b/Super Polarity/obj/x86/Debug/Super Polarity.pdb differ