]> git.r.bdr.sh - rbdr/super-polarity/commitdiff
Protoshow sprint.
authorBen Beltran <redacted>
Sat, 23 Nov 2013 19:54:16 +0000 (13:54 -0600)
committerBen Beltran <redacted>
Sat, 23 Nov 2013 19:54:16 +0000 (13:54 -0600)
40 files changed:
Super Polarity Content/Super Polarity ContentContent/Fonts/bigfont.png [new file with mode: 0644]
Super Polarity Content/Super Polarity ContentContent/Fonts/smallfont.png [new file with mode: 0644]
Super Polarity Content/Super Polarity ContentContent/Graphics/pause-screen.png [new file with mode: 0644]
Super Polarity Content/Super Polarity ContentContent/Graphics/polaritydemotitle.png [new file with mode: 0644]
Super Polarity Content/Super Polarity ContentContent/Sound/polaritytheme.wav [new file with mode: 0644]
Super Polarity Content/Super Polarity ContentContent/Super Polarity ContentContent.contentproj
Super Polarity.suo
Super Polarity/ActorFactory.cs
Super Polarity/ActorManager.cs
Super Polarity/Actors/Actor.cs
Super Polarity/Actors/Bullet.cs
Super Polarity/Actors/MainShip.cs
Super Polarity/Actors/Ship.cs
Super Polarity/BasicGenerator.cs
Super Polarity/Content/Fonts/bigfont.xnb [new file with mode: 0644]
Super Polarity/Content/Fonts/smallfont.xnb [new file with mode: 0644]
Super Polarity/Content/Graphics/pause-screen.xnb [new file with mode: 0644]
Super Polarity/Content/Graphics/polaritydemotitle.xnb [new file with mode: 0644]
Super Polarity/Content/Sound/bomb.wav [new file with mode: 0644]
Super Polarity/Content/Sound/bullet.wav [new file with mode: 0644]
Super Polarity/Content/Sound/gameover.wav [new file with mode: 0644]
Super Polarity/Content/Sound/hit.wav [new file with mode: 0644]
Super Polarity/Content/Sound/life.wav [new file with mode: 0644]
Super Polarity/Content/Sound/polaritychange.wav [new file with mode: 0644]
Super Polarity/Content/Sound/polaritytheme.wav [new file with mode: 0644]
Super Polarity/GameScreen.cs
Super Polarity/InputController.cs
Super Polarity/Player.cs
Super Polarity/Renderer.cs
Super Polarity/Screen.cs
Super Polarity/ScreenManager.cs
Super Polarity/Super Polarity.csproj
Super Polarity/SuperPolarity.cs
Super Polarity/TitleScreen.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/Fonts/bigfont.png b/Super Polarity Content/Super Polarity ContentContent/Fonts/bigfont.png
new file mode 100644 (file)
index 0000000..67307dd
Binary files /dev/null and b/Super Polarity Content/Super Polarity ContentContent/Fonts/bigfont.png differ
diff --git a/Super Polarity Content/Super Polarity ContentContent/Fonts/smallfont.png b/Super Polarity Content/Super Polarity ContentContent/Fonts/smallfont.png
new file mode 100644 (file)
index 0000000..51a2c14
Binary files /dev/null and b/Super Polarity Content/Super Polarity ContentContent/Fonts/smallfont.png differ
diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/pause-screen.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/pause-screen.png
new file mode 100644 (file)
index 0000000..0d6db73
Binary files /dev/null and b/Super Polarity Content/Super Polarity ContentContent/Graphics/pause-screen.png differ
diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/polaritydemotitle.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/polaritydemotitle.png
new file mode 100644 (file)
index 0000000..10a9b92
Binary files /dev/null and b/Super Polarity Content/Super Polarity ContentContent/Graphics/polaritydemotitle.png differ
diff --git a/Super Polarity Content/Super Polarity ContentContent/Sound/polaritytheme.wav b/Super Polarity Content/Super Polarity ContentContent/Sound/polaritytheme.wav
new file mode 100644 (file)
index 0000000..28a6bce
Binary files /dev/null and b/Super Polarity Content/Super Polarity ContentContent/Sound/polaritytheme.wav differ
index 2b327e7438357bfb5f84aa4032e6afbdd51b2edb..12417a22fe8f56a0a8913033223b6bf93c3582b7 100644 (file)
     </Compile>
   </ItemGroup>
   <ItemGroup>
     </Compile>
   </ItemGroup>
   <ItemGroup>
-    <Folder Include="Sound\" />
+    <Compile Include="Graphics\pause-screen.png">
+      <Name>pause-screen</Name>
+      <Importer>TextureImporter</Importer>
+      <Processor>TextureProcessor</Processor>
+    </Compile>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Graphics\circle.png">
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Graphics\circle.png">
       <Processor>FontDescriptionProcessor</Processor>
     </Compile>
   </ItemGroup>
       <Processor>FontDescriptionProcessor</Processor>
     </Compile>
   </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Sound\polaritytheme.wav">
+      <Name>polaritytheme</Name>
+      <Importer>WavImporter</Importer>
+      <Processor>SongProcessor</Processor>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Graphics\polaritydemotitle.png">
+      <Name>polaritydemotitle</Name>
+      <Importer>TextureImporter</Importer>
+      <Processor>TextureProcessor</Processor>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Fonts\bigfont.png">
+      <Name>bigfont</Name>
+      <Importer>TextureImporter</Importer>
+      <Processor>FontTextureProcessor</Processor>
+    </Compile>
+    <Compile Include="Fonts\smallfont.png">
+      <Name>smallfont</Name>
+      <Importer>TextureImporter</Importer>
+      <Processor>FontTextureProcessor</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 4f5c9c9f8f71999d547cdb59f754140724e566fa..ae197e2a9b3d7a72ae596d171129e830625fcaa1 100644 (file)
Binary files a/Super Polarity.suo and b/Super Polarity.suo differ
index 9995707ce0cfe45a00460e363dd25161848b4ba5..f9c7697b2bb2b3b13f3e12db48d176d2215c85b1 100644 (file)
@@ -18,7 +18,6 @@ namespace SuperPolarity
             mainShip.Initialize(Game.Content.Load<Texture2D>("Graphics\\main-ship"), position);
 
             ActorManager.CheckIn(mainShip);
             mainShip.Initialize(Game.Content.Load<Texture2D>("Graphics\\main-ship"), position);
 
             ActorManager.CheckIn(mainShip);
-            Renderer.CheckIn(mainShip);
 
             return mainShip;
         }
 
             return mainShip;
         }
@@ -45,7 +44,6 @@ namespace SuperPolarity
             ship.SetPolarity(polarity);
 
             ActorManager.CheckIn(ship);
             ship.SetPolarity(polarity);
 
             ActorManager.CheckIn(ship);
-            Renderer.CheckIn(ship);
 
             return ship;
         }
 
             return ship;
         }
@@ -64,7 +62,6 @@ namespace SuperPolarity
             bullet.Angle = angle;
 
             ActorManager.CheckIn(bullet);
             bullet.Angle = angle;
 
             ActorManager.CheckIn(bullet);
-            Renderer.CheckIn(bullet);
 
             return bullet;
         }
 
             return bullet;
         }
@@ -93,7 +90,7 @@ namespace SuperPolarity
             ship.BoxDimensions.Z = 10;
 
             ship.Initialize(texture, position);
             ship.BoxDimensions.Z = 10;
 
             ship.Initialize(texture, position);
-            ship.MaxVelocity = 5.5f;
+            ship.MaxVelocity = 5.2f;
             ship.FleeVelocity = 6.5f;
             ship.ChargeVelocity = 5.5f;
             ship.Value = 3;
             ship.FleeVelocity = 6.5f;
             ship.ChargeVelocity = 5.5f;
             ship.Value = 3;
@@ -102,7 +99,6 @@ namespace SuperPolarity
             ship.SetPolarity(polarity);
 
             ActorManager.CheckIn(ship);
             ship.SetPolarity(polarity);
 
             ActorManager.CheckIn(ship);
-            Renderer.CheckIn(ship);
 
             return ship;
         }
 
             return ship;
         }
@@ -131,15 +127,16 @@ namespace SuperPolarity
             ship.BoxDimensions.Z = 40;
 
             ship.Initialize(texture, position);
             ship.BoxDimensions.Z = 40;
 
             ship.Initialize(texture, position);
+            ship.MagneticRadius = 1000;
+            ship.RepelRadius = 200;
             ship.MaxVelocity = 0.5f;
             ship.FleeVelocity = 5;
             ship.ChargeVelocity = 1;
             ship.Value = 10;
             ship.MaxVelocity = 0.5f;
             ship.FleeVelocity = 5;
             ship.ChargeVelocity = 1;
             ship.Value = 10;
-            ship.HP = 9;
+            ship.HP = 29;
             ship.SetPolarity(polarity);
 
             ActorManager.CheckIn(ship);
             ship.SetPolarity(polarity);
 
             ActorManager.CheckIn(ship);
-            Renderer.CheckIn(ship);
 
             return ship;
         }
 
             return ship;
         }
index 8cd265a432a06d10867bd6fdd3e86836a638eb94..f5587b9c9f772872a3915720451706b6fe3efcd8 100644 (file)
@@ -27,7 +27,9 @@ namespace SuperPolarity
 
         static public void CheckOut(Actor actor)
         {
 
         static public void CheckOut(Actor actor)
         {
+            actor.CleanUp();
             Actors.Remove(actor);
             Actors.Remove(actor);
+            actor = null;
         }
 
         static public void Update(GameTime gameTime) 
         }
 
         static public void Update(GameTime gameTime) 
@@ -55,6 +57,12 @@ namespace SuperPolarity
                 if (i >= Actors.Count) {
                     i = Actors.Count - 1;
                 }
                 if (i >= Actors.Count) {
                     i = Actors.Count - 1;
                 }
+
+                if (Actors.Count == 0)
+                {
+                    return;
+                }
+
                 Actor actor = Actors[i];
                 for (var j = i - 1; j >= 0; j--)
                 {
                 Actor actor = Actors[i];
                 for (var j = i - 1; j >= 0; j--)
                 {
@@ -110,13 +118,43 @@ namespace SuperPolarity
                     actor.Position.Y > Game.GraphicsDevice.Viewport.Height + OutlierBounds)
                 {
                     CheckOut(actor);
                     actor.Position.Y > Game.GraphicsDevice.Viewport.Height + OutlierBounds)
                 {
                     CheckOut(actor);
+                    if (actor.Parent != null)
+                    {
+                        actor.Parent.Children.Remove(actor);
+                    }
                 }
             }
         }
 
                 }
             }
         }
 
+        static public void Empty()
+        {
+            foreach (Actor actor in Actors) {
+                actor.CleanUp();
+            }
+            Actors.Clear();
+        }
+
         internal static void SetGame(SuperPolarity game)
         {
             Game = game;
         }
         internal static void SetGame(SuperPolarity game)
         {
             Game = game;
         }
+
+        public static void Bomb()
+        {
+            for (var i = Actors.Count - 1; i >= 0; i--)
+            {
+                var actor = Actors[i];
+                if (actor.GetType() == typeof(StandardShip))
+                {
+                    CheckOut(actor);
+                    Renderer.CheckOut(actor);
+                }
+            }
+        }
+
+        public static int CountBaddies()
+        {
+            return Actors.Where(a => a.GetType() == typeof(StandardShip)).Count();
+        }
     }
 }
     }
 }
index c3177962182beb92ccb8dfdf21d9d31bfada8c3b..3bb06beeedcae39694d87fb4f1e78357dddd9b9e 100644 (file)
@@ -204,13 +204,21 @@ namespace SuperPolarity
 
         public virtual void Draw(SpriteBatch spriteBatch)
         {
 
         public virtual void Draw(SpriteBatch spriteBatch)
         {
-            foreach (Actor child in Children)
+            Actor child = null;
+            
+            //  TODO: Check what's up with the null children.
+            if (Children == null)
             {
             {
+                return;
+            }
+            for (var i = Children.Count - 1; i >= 0; i--)
+            {
+                child = Children[i];
                 child.Draw(spriteBatch);
             }
 
             spriteBatch.Draw(Texture, Position, null, Color, Angle, Origin, 1f, SpriteEffects.None, 0f);
                 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()
         }
 
         void CheckOutliers()
@@ -247,5 +255,13 @@ namespace SuperPolarity
         {
             Dying = true;
         }
         {
             Dying = true;
         }
+
+        public virtual void CleanUp()
+        {
+            Texture = null;
+            BoxTexture = null;
+            Children = null;
+            Texture = null;
+        }
     }
 }
     }
 }
index 6b797c2d4176e714ab4523a04e60467c9f96678a..d20289cd536aa832ac8a1e7d5ff2764877474c87 100644 (file)
@@ -70,5 +70,11 @@ namespace SuperPolarity
             Renderer.CheckOut(this);
             Parent.Children.Remove(this);
         }
             Renderer.CheckOut(this);
             Parent.Children.Remove(this);
         }
+
+        public override void CleanUp()
+        {
+            base.CleanUp();
+            this.particleEngine = null;
+        }
     }
 }
     }
 }
index 616f16e507779277b65fe0a0114a03b98e731368..9f28c80c5c51298888ceb095e59641cab87b0886 100644 (file)
@@ -6,6 +6,7 @@ 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;
+using Microsoft.Xna.Framework.Audio;
 
 namespace SuperPolarity
 {
 
 namespace SuperPolarity
 {
@@ -24,6 +25,10 @@ namespace SuperPolarity
         protected float MaxImmortalTime;
         protected bool Flashing;
 
         protected float MaxImmortalTime;
         protected bool Flashing;
 
+        protected SoundEffect PolarityChange;
+        protected SoundEffect ShootSound;
+        protected SoundEffect Hit;
+
         public MainShip(SuperPolarity newGame) : base(newGame) {}
 
         ~MainShip()
         public MainShip(SuperPolarity newGame) : base(newGame) {}
 
         ~MainShip()
@@ -35,12 +40,18 @@ namespace SuperPolarity
         {
             base.Initialize(texture, position);
 
         {
             base.Initialize(texture, position);
 
-            MainShip.BlueColor = new Color(230, 244, 249);
-            MainShip.RedColor = new Color(255, 234, 241);
+            MainShip.BlueColor = new Color(0, 184, 229);
+            MainShip.RedColor = new Color(201, 0, 68);
+
+            PolarityChange = game.Content.Load<SoundEffect>("Sound\\polaritychange");
+            ShootSound = game.Content.Load<SoundEffect>("Sound\\bullet");
+            Hit = game.Content.Load<SoundEffect>("Sound\\hit");
 
             InitParticleEngine();
             SetPolarity(Polarity.Positive);
 
 
             InitParticleEngine();
             SetPolarity(Polarity.Positive);
 
+            ActVelocity = 2.5f;
+
             ShotCooldown = 50;
             MaxImmortalTime = 1500;
 
             ShotCooldown = 50;
             MaxImmortalTime = 1500;
 
@@ -68,19 +79,28 @@ namespace SuperPolarity
 
         protected void HandleShot(float value)
         {
 
         protected void HandleShot(float value)
         {
+
+            Shooting = true;
+            Timer t = new Timer(new TimerCallback(UnlockShot));
+            t.Change(ShotCooldown, Timeout.Infinite);
+
+            if (Children.Count > 10)
+            {
+                return;
+            }
+
             var bullet = ActorFactory.CreateBullet(Position, Angle);
 
             Children.Add(bullet);
             bullet.Parent = this;
 
             var bullet = ActorFactory.CreateBullet(Position, Angle);
 
             Children.Add(bullet);
             bullet.Parent = this;
 
-            Shooting = true;
-            Timer t = new Timer(new TimerCallback(UnlockShot));
-            t.Change(ShotCooldown, Timeout.Infinite);
+            ShootSound.Play();
         }
 
         protected void UnlockShot(object state)
         {
             InputController.Unlock("shoot");
         }
 
         protected void UnlockShot(object state)
         {
             InputController.Unlock("shoot");
+            Shooting = false;
         }
 
         protected void HandleChangePolarity(float value)
         }
 
         protected void HandleChangePolarity(float value)
@@ -90,28 +110,29 @@ namespace SuperPolarity
 
         public void HandleHorizontalMovement(float value)
         {
 
         public void HandleHorizontalMovement(float value)
         {
-            Acceleration.X = value * AccelerationRate;
-
-            if (value > 0.1 && Velocity.X < 0 || value < 0.1 && Velocity.X > 0)
+            if (value >= -0.5 && value <= 0.5)
             {
             {
-                Acceleration.X *= 2;
+                value = 0;
             }
 
             }
 
-            if (value > 0.1 && Velocity.Y < 0 || value < 0.1 && Velocity.Y > 0)
-            {
-                Acceleration.Y *= 2;
-            }
+            Velocity.X = value * MaxVelocity;
         }
 
         public void HandleVerticalMovement(float value)
         {
         }
 
         public void HandleVerticalMovement(float value)
         {
-            Acceleration.Y = value * AccelerationRate;
+            if (value >= -0.5 && value <= 0.5)
+            {
+                value = 0;
+            }
+
+            Velocity.Y = value * MaxVelocity;
         }
 
         public override void SwitchPolarity()
         {
             base.SwitchPolarity();
             SwitchParticleEngine(CurrentPolarity);
         }
 
         public override void SwitchPolarity()
         {
             base.SwitchPolarity();
             SwitchParticleEngine(CurrentPolarity);
+            PolarityChange.Play();
             game.Player.ResetMultiplier();
         }
 
             game.Player.ResetMultiplier();
         }
 
@@ -144,7 +165,6 @@ namespace SuperPolarity
             particleEngine.Update();
             ConstrainToEdges();
             UpdateImmortality(gameTime);
             particleEngine.Update();
             ConstrainToEdges();
             UpdateImmortality(gameTime);
-            Shooting = false;
         }
 
         public void UpdateImmortality(GameTime gameTime)
         }
 
         public void UpdateImmortality(GameTime gameTime)
@@ -174,30 +194,36 @@ namespace SuperPolarity
 
         public override void Move(GameTime gameTime)
         {
 
         public override void Move(GameTime gameTime)
         {
-            base.Move(gameTime);
+            var VelocityLimit = MaxVelocity;
+            var SavedVelocity = new Vector2(Velocity.X, Velocity.Y);
 
             if (Shooting)
             {
 
             if (Shooting)
             {
-                if (Velocity.X > ActVelocity)
-                {
-                    Velocity.X = ActVelocity;
-                }
+                VelocityLimit = ActVelocity;
+            }
 
 
-                if (Velocity.X < -ActVelocity)
-                {
-                    Velocity.X = -ActVelocity;
-                }
+            if (SavedVelocity.X > VelocityLimit)
+            {
+                SavedVelocity.X = VelocityLimit;
+            }
 
 
-                if (Velocity.Y > ActVelocity)
-                {
-                    Velocity.Y = ActVelocity;
-                }
+            if (SavedVelocity.X < -VelocityLimit)
+            {
+                SavedVelocity.X = -VelocityLimit;
+            }
 
 
-                if (Velocity.Y < -ActVelocity)
-                {
-                    Velocity.Y = -ActVelocity;
-                }
+            if (SavedVelocity.Y > VelocityLimit)
+            {
+                SavedVelocity.Y = VelocityLimit;
+            }
+
+            if (SavedVelocity.Y < -VelocityLimit)
+            {
+                SavedVelocity.Y = -VelocityLimit;
             }
             }
+
+            Position.X = Position.X + SavedVelocity.X;
+            Position.Y = Position.Y + SavedVelocity.Y;
         }
 
         public override void Magnetize(Ship ship, float distance, float angle)
         }
 
         public override void Magnetize(Ship ship, float distance, float angle)
@@ -266,11 +292,23 @@ namespace SuperPolarity
             if (game.Player.Lives < 0)
             {
                 Dying = true;
             if (game.Player.Lives < 0)
             {
                 Dying = true;
+                game.GameOver();
             }
             else {
             }
             else {
+                Hit.Play();
                 Immortal = true;
                 CurrentImmortalTime = 0;
             }
         }
                 Immortal = true;
                 CurrentImmortalTime = 0;
             }
         }
+
+        public override void CleanUp()
+        {
+            base.CleanUp();
+            particleEngine = null;
+            InputController.Unbind("moveX", HandleHorizontalMovement);
+            InputController.Unbind("moveY", HandleVerticalMovement);
+            InputController.Unbind("changePolarity", HandleChangePolarity);
+            InputController.Unbind("shoot", HandleShot);
+        }
     }
 }
     }
 }
index 49d0b1412f5beccd846abe76e081f117a932bd50..229f639ea4945cf16b4819aabb2ba5ee8c51cb19 100644 (file)
@@ -17,7 +17,7 @@ namespace SuperPolarity
         public float FleeVelocity;
         public float ActVelocity;
         public float ChargeVelocity;
         public float FleeVelocity;
         public float ActVelocity;
         public float ChargeVelocity;
-        protected int RepelRadius;
+        public int RepelRadius;
 
         protected bool Magnetizing;
 
 
         protected bool Magnetizing;
 
index 7cc45449d0e9179985c380b21f4de2e45b791b3f..ba517424dae1834e1d6fcd192e374dfd83829083 100644 (file)
@@ -26,11 +26,17 @@ namespace SuperPolarity
             Rate = rate;
             Randomizer = new Random();
             Position = position;
             Rate = rate;
             Randomizer = new Random();
             Position = position;
+            CurrentTime = rate;
         }
 
         public void Update(GameTime gameTime)
         {
         }
 
         public void Update(GameTime gameTime)
         {
-            if (Game.Player.Score > ScoreThreshold)
+            if (ActorManager.CountBaddies() > 50)
+            {
+                return;
+            }
+
+            if (Game.Player.Score >= ScoreThreshold)
             {
                 CurrentTime = CurrentTime + gameTime.ElapsedGameTime.Milliseconds;
 
             {
                 CurrentTime = CurrentTime + gameTime.ElapsedGameTime.Milliseconds;
 
@@ -53,17 +59,17 @@ namespace SuperPolarity
 
             if (ShipType == Ships.Ship)
             {
 
             if (ShipType == Ships.Ship)
             {
-                ActorFactory.CreateShip(polarity, Position);
+                Renderer.CheckIn(ActorFactory.CreateShip(polarity, Position));
             }
 
             if (ShipType == Ships.Scout)
             {
             }
 
             if (ShipType == Ships.Scout)
             {
-                ActorFactory.CreateScout(polarity, Position);
+                Renderer.CheckIn(ActorFactory.CreateScout(polarity, Position));
             }
 
             if (ShipType == Ships.Battlecruiser)
             {
             }
 
             if (ShipType == Ships.Battlecruiser)
             {
-                ActorFactory.CreateCruiser(polarity, Position);
+                Renderer.CheckIn(ActorFactory.CreateCruiser(polarity, Position));
             }
 
         }
             }
 
         }
diff --git a/Super Polarity/Content/Fonts/bigfont.xnb b/Super Polarity/Content/Fonts/bigfont.xnb
new file mode 100644 (file)
index 0000000..c1d876c
Binary files /dev/null and b/Super Polarity/Content/Fonts/bigfont.xnb differ
diff --git a/Super Polarity/Content/Fonts/smallfont.xnb b/Super Polarity/Content/Fonts/smallfont.xnb
new file mode 100644 (file)
index 0000000..a87e66a
Binary files /dev/null and b/Super Polarity/Content/Fonts/smallfont.xnb differ
diff --git a/Super Polarity/Content/Graphics/pause-screen.xnb b/Super Polarity/Content/Graphics/pause-screen.xnb
new file mode 100644 (file)
index 0000000..2307009
Binary files /dev/null and b/Super Polarity/Content/Graphics/pause-screen.xnb differ
diff --git a/Super Polarity/Content/Graphics/polaritydemotitle.xnb b/Super Polarity/Content/Graphics/polaritydemotitle.xnb
new file mode 100644 (file)
index 0000000..2fa9cf3
Binary files /dev/null and b/Super Polarity/Content/Graphics/polaritydemotitle.xnb differ
diff --git a/Super Polarity/Content/Sound/bomb.wav b/Super Polarity/Content/Sound/bomb.wav
new file mode 100644 (file)
index 0000000..5af439b
Binary files /dev/null and b/Super Polarity/Content/Sound/bomb.wav differ
diff --git a/Super Polarity/Content/Sound/bullet.wav b/Super Polarity/Content/Sound/bullet.wav
new file mode 100644 (file)
index 0000000..6586489
Binary files /dev/null and b/Super Polarity/Content/Sound/bullet.wav differ
diff --git a/Super Polarity/Content/Sound/gameover.wav b/Super Polarity/Content/Sound/gameover.wav
new file mode 100644 (file)
index 0000000..cac9d23
Binary files /dev/null and b/Super Polarity/Content/Sound/gameover.wav differ
diff --git a/Super Polarity/Content/Sound/hit.wav b/Super Polarity/Content/Sound/hit.wav
new file mode 100644 (file)
index 0000000..43433cd
Binary files /dev/null and b/Super Polarity/Content/Sound/hit.wav differ
diff --git a/Super Polarity/Content/Sound/life.wav b/Super Polarity/Content/Sound/life.wav
new file mode 100644 (file)
index 0000000..a1d0436
Binary files /dev/null and b/Super Polarity/Content/Sound/life.wav differ
diff --git a/Super Polarity/Content/Sound/polaritychange.wav b/Super Polarity/Content/Sound/polaritychange.wav
new file mode 100644 (file)
index 0000000..25b59a4
Binary files /dev/null and b/Super Polarity/Content/Sound/polaritychange.wav differ
diff --git a/Super Polarity/Content/Sound/polaritytheme.wav b/Super Polarity/Content/Sound/polaritytheme.wav
new file mode 100644 (file)
index 0000000..28a6bce
Binary files /dev/null and b/Super Polarity/Content/Sound/polaritytheme.wav differ
index 28fd7b758d18bbd43ad10e50a46e4094faba73a4..783e3c12a61f57dc8a08e24634b32b142d077018 100644 (file)
@@ -4,6 +4,8 @@ using System.Linq;
 using System.Text;
 using Microsoft.Xna.Framework;
 using Microsoft.Xna.Framework.Graphics;
 using System.Text;
 using Microsoft.Xna.Framework;
 using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Audio;
+using Microsoft.Xna.Framework.Media;
 using Microsoft.Xna.Framework.Input;
 
 namespace SuperPolarity
 using Microsoft.Xna.Framework.Input;
 
 namespace SuperPolarity
@@ -12,42 +14,196 @@ namespace SuperPolarity
     {
         public GameScreen(SuperPolarity newGame) : base(newGame) {}
 
     {
         public GameScreen(SuperPolarity newGame) : base(newGame) {}
 
-        private BasicGenerator generatorTest;
+        protected List<BasicGenerator> Generators;
+
+        protected int LivesRate;
+        protected int CurrentLivesRate;
+        protected int BombRate;
+        protected int CurrentBombRate;
+        protected SoundEffect BombSound;
+        protected SoundEffect LifeSound;
+        
+        protected bool Flashing;
+
+        protected bool IsPaused;
+        protected Texture2D PauseScreen;
 
         public override void Initialize()
         {
 
         public override void Initialize()
         {
+            Generators = new List<BasicGenerator>();
+
+            CurrentBombRate = 1;
+            BombRate = 6000;
+
+            LivesRate = 10000;
+            CurrentLivesRate = 1;
+
             InputController.RegisterEventForButton("changePolarity", Buttons.A);
             InputController.RegisterEventForKey("changePolarity", Keys.Z);
 
             InputController.RegisterEventForButton("shoot", Buttons.X);
             InputController.RegisterEventForKey("shoot", Keys.X);
             InputController.RegisterEventForButton("changePolarity", Buttons.A);
             InputController.RegisterEventForKey("changePolarity", Keys.Z);
 
             InputController.RegisterEventForButton("shoot", Buttons.X);
             InputController.RegisterEventForKey("shoot", Keys.X);
+
+            InputController.Bind("pause", HandlePause);
+
+            PauseScreen = Game.Content.Load<Texture2D>("Graphics\\pause-screen");
+        }
+
+        protected void HandlePause(float value)
+        {
+            Console.WriteLine("Paused");
+            IsPaused = !IsPaused;
+
+            if (IsPaused)
+            {
+                MediaPlayer.Volume = 0.05f;
+            }
+            else
+            {
+                MediaPlayer.Volume = 1;
+            }
         }
 
         public override void LoadContent()
         {
         }
 
         public override void LoadContent()
         {
+            CreateGenerators();
+
+            Vector2 playerPosition = new Vector2(Game.GraphicsDevice.Viewport.TitleSafeArea.X + Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.TitleSafeArea.Y + Game.GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
 
 
-            generatorTest = new BasicGenerator();
-            generatorTest.Initialize(Game, new Vector2(100, 600), BasicGenerator.Ships.Scout, 3000, 10);
+            BombSound = Game.Content.Load<SoundEffect>("Sound\\bomb");
+            LifeSound = Game.Content.Load<SoundEffect>("Sound\\life");
 
 
-            Vector2 playerPosition = new Vector2(Game.GraphicsDevice.Viewport.TitleSafeArea.X, Game.GraphicsDevice.Viewport.TitleSafeArea.Y + Game.GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
+            Renderer.CheckIn(ActorFactory.CreateMainShip(playerPosition));
 
 
-            ActorFactory.CreateMainShip(playerPosition);
-            ActorFactory.CreateShip(Ship.Polarity.Positive, new Vector2(200, 200));
-            ActorFactory.CreateShip(Ship.Polarity.Negative, new Vector2(400, 200));
-            ActorFactory.CreateScout(Ship.Polarity.Negative, new Vector2(500, 500));
-            ActorFactory.CreateCruiser(Ship.Polarity.Positive, new Vector2(40, 40));
+            Game.PlaySong("game");
+        }
+        
+        protected void CalculateBomb()
+        {
+            if (Game.Player.Score >= BombRate * CurrentBombRate)
+            {
+                ActorManager.Bomb();
+                Flashing = true;
+                BombSound.Play();
+                CurrentBombRate = CurrentBombRate + 1;
+            }
+        }
+
+        protected void CalculateLife()
+        {
+            if (Game.Player.Score >= LivesRate * CurrentLivesRate)
+            {
+                Game.Player.Lives = Game.Player.Lives + 1;
+                LifeSound.Play();
+                CurrentLivesRate = CurrentLivesRate + 1;
+            }
         }
 
         public override void Update(GameTime gameTime)
         {
         }
 
         public override void Update(GameTime gameTime)
         {
-            InputController.UpdateInput();
+            CalculateBomb();
+            CalculateLife();
+            InputController.UpdateInput(IsPaused);
+            if (IsPaused)
+            {
+                return;
+            }
             ActorManager.Update(gameTime);
             ActorManager.Update(gameTime);
-            generatorTest.Update(gameTime);
+
+            foreach (BasicGenerator generator in Generators)
+            {
+                generator.Update(gameTime);
+            }
         }
 
         public override void Draw(SpriteBatch spriteBatch)
         {
             Renderer.Draw(spriteBatch);
         }
 
         public override void Draw(SpriteBatch spriteBatch)
         {
             Renderer.Draw(spriteBatch);
+            Game.Player.Draw(spriteBatch);
+
+            if (IsPaused)
+            {
+                spriteBatch.Draw(PauseScreen, new Vector2(0, 0), Color.White);
+            }
+
+            if (Flashing)
+            {
+                Game.GraphicsDevice.Clear(Color.Black);
+                Flashing = false;
+            }
+        }
+
+        protected void CreateGenerators()
+        {
+            // The basic ship generators.
+            var gen = new BasicGenerator();
+            gen.Initialize(Game, new Vector2(-50, -50), BasicGenerator.Ships.Ship, 3000, 0);
+            Generators.Add(gen); 
+            
+            gen = new BasicGenerator();
+            gen.Initialize(Game, new Vector2(-50, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Ship, 3000, 0);
+            Generators.Add(gen); 
+            
+            gen = new BasicGenerator();
+            gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width + 50, -50), BasicGenerator.Ships.Ship, 3000, 0);
+            Generators.Add(gen);
+
+            gen = new BasicGenerator();
+            gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width + 50, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Ship, 3000, 0);
+            Generators.Add(gen);
+
+            // After 1.5k liberate some sporadic Scouts, and add two more ship generators.
+            gen = new BasicGenerator();
+            gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, -50), BasicGenerator.Ships.Ship, 3000, 1500);
+            Generators.Add(gen);
+
+            gen = new BasicGenerator();
+            gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Ship, 3000, 1500);
+            Generators.Add(gen);
+
+            gen = new BasicGenerator();
+            gen.Initialize(Game, new Vector2(-50, Game.GraphicsDevice.Viewport.Height / 2), BasicGenerator.Ships.Scout, 6000, 1500);
+            Generators.Add(gen);
+
+            gen = new BasicGenerator();
+            gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width + 50, Game.GraphicsDevice.Viewport.Height / 2), BasicGenerator.Ships.Scout, 6000, 1500);
+            Generators.Add(gen);
+
+
+            // After 3k add more scouts.
+            gen = new BasicGenerator();
+            gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, -50), BasicGenerator.Ships.Scout, 3000, 3000);
+            Generators.Add(gen);
+
+            gen = new BasicGenerator();
+            gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Scout, 3000, 5000);
+            Generators.Add(gen);
+
+            // After 5k release more ships and a cruiser.
+            gen = new BasicGenerator();
+            gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, -50), BasicGenerator.Ships.Ship, 1500, 5000);
+            Generators.Add(gen);
+
+            gen = new BasicGenerator();
+            gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Ship, 1500, 5000);
+            Generators.Add(gen);
+
+            gen = new BasicGenerator();
+            gen.Initialize(Game, new Vector2(-50, Game.GraphicsDevice.Viewport.Height / 2), BasicGenerator.Ships.Battlecruiser, 10000, 5000);
+            Generators.Add(gen);
+
+            gen = new BasicGenerator();
+            gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width + 50, Game.GraphicsDevice.Viewport.Height / 2), BasicGenerator.Ships.Battlecruiser, 10000, 5000);
+            Generators.Add(gen);
+        }
+
+        public override void CleanUp()
+        {
+            base.CleanUp();
+            Generators.Clear();
+            InputController.Unbind("pause", HandlePause);
+            Renderer.Empty();
+            ActorManager.Empty();
         }
     }
 }
         }
     }
 }
index 79bd0391bedb6e0b077365021dc57ce5a7022f09..c92bb9c37b8bc7500d8762d35d3c2fcf068428f3 100644 (file)
@@ -37,11 +37,42 @@ namespace SuperPolarity
 
         public static void UpdateInput()
         {
 
         public static void UpdateInput()
         {
-            Poll();
             DispatchMoveEvents();
             DispatchRegisteredEvents();
         }
 
             DispatchMoveEvents();
             DispatchRegisteredEvents();
         }
 
+        public static void UpdateInput(bool highPriorityOnly) 
+        {
+            Poll();
+            DispatchPauseEvent();
+            if (!highPriorityOnly)
+            {
+                UpdateInput();
+            }
+        }
+
+        public static void DispatchPauseEvent()
+        {
+            // OK THIS IS ALL KINDS OF WRONG. THIS IS A PLACEHOLDER BECAUSE DEMO!
+            var keyPressed = false;
+            if ((InputKeyboardState.IsKeyDown(Keys.Enter) || InputGamePadState.IsButtonDown(Buttons.Start))) {
+                keyPressed = true;
+                if(!BlockedButtons.Contains("pause") && !BlockedKeys.Contains("pause"))
+                {
+                    BlockedButtons.Add("pause");
+                    BlockedKeys.Add("pause");
+                    Console.WriteLine("Dispatch");
+                    Dispatch("pause", 0);
+                }
+            }
+
+            if (!keyPressed)
+            {
+                BlockedButtons.Remove("pause");
+                BlockedKeys.Remove("pause");
+            }
+        }
+
         private static void Poll()
         {
             InputGamePadState = GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One);
         private static void Poll()
         {
             InputGamePadState = GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One);
@@ -175,6 +206,21 @@ namespace SuperPolarity
             listenerList.Add(listener);
         }
 
             listenerList.Add(listener);
         }
 
+        public static void Unbind(string eventName, Action<float> listener)
+        {
+            List<Action<float>> listenerList;
+            bool foundListeners;
+
+            if (!Listeners.ContainsKey(eventName))
+            {
+                return;
+            }
+
+            foundListeners = Listeners.TryGetValue(eventName, out listenerList);
+
+            listenerList.Remove(listener);
+        }
+
         public static void Dispatch(string eventName, float value)
         {
             List<Action<float>> listenerList;
         public static void Dispatch(string eventName, float value)
         {
             List<Action<float>> listenerList;
@@ -187,9 +233,9 @@ namespace SuperPolarity
                 return;
             }
 
                 return;
             }
 
-            foreach (Action<float> method in listenerList)
+            for (var i = listenerList.Count - 1; i >= 0; i--)
             {
             {
-                method(value);
+                listenerList[i](value);
             }
         }
 
             }
         }
 
index 25e66da7f668d750096c36cc0028f10237e2904a..2680a1ce4397cc83053335897662d2f45f6ba149 100644 (file)
@@ -2,6 +2,8 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
 
 namespace SuperPolarity
 {
 
 namespace SuperPolarity
 {
@@ -11,11 +13,20 @@ namespace SuperPolarity
         public int Multiplier;
         public int Lives;
 
         public int Multiplier;
         public int Lives;
 
-        public Player()
+
+        SpriteFont DebugFont;
+        SuperPolarity Game;
+
+        Texture2D LifeSprite;
+
+        public Player(SuperPolarity game)
         {
             Score = 0;
             Multiplier = 1;
             Lives = 3;
         {
             Score = 0;
             Multiplier = 1;
             Lives = 3;
+            Game = game;
+            DebugFont = Game.Content.Load<SpriteFont>("Fonts\\bigfont");
+            LifeSprite = Game.Content.Load<Texture2D>("Graphics\\neutral-ship");
         }
 
         public void AddScore(int value)
         }
 
         public void AddScore(int value)
@@ -33,14 +44,38 @@ namespace SuperPolarity
             Multiplier = 1;
         }
 
             Multiplier = 1;
         }
 
-        public void Draw()
+        public void Draw(SpriteBatch spriteBatch)
         {
         {
+            var UiColor = new Color(0, 0, 0, 200);
+            var lightColor = new Color(0, 0, 0, 128);
+            spriteBatch.DrawString(DebugFont, Score.ToString(), new Vector2(10, 10), UiColor);
+            spriteBatch.DrawString(DebugFont, "x" + Multiplier.ToString(), new Vector2(10, 30), lightColor);
 
 
+            var lifePosition = new Vector2(Game.GraphicsDevice.Viewport.Width - 120, 10);
+            if (Lives > 4)
+            {
+                spriteBatch.Draw(LifeSprite, lifePosition, null, UiColor, (float)(Math.PI / 2), Vector2.Zero, 0.5f, SpriteEffects.None, 0f);
+                spriteBatch.DrawString(DebugFont, "x " + Lives.ToString(), new Vector2(lifePosition.X + 8, lifePosition.Y + 5), UiColor);
+            }
+            else
+            {
+                for (var i = 0; i < Lives; i++)
+                {
+                    spriteBatch.Draw(LifeSprite, new Vector2(lifePosition.X + (i * 28), lifePosition.Y), null, UiColor, (float)(Math.PI / 2), Vector2.Zero, 0.5f, SpriteEffects.None, 0f);
+                }
+            }
         }
 
         public void Update()
         {
 
         }
         }
 
         public void Update()
         {
 
         }
+
+        public void Reset()
+        {
+            Score = 0;
+            Multiplier = 1;
+            Lives = 3;
+        }
     }
 }
     }
 }
index 2f5c5aa30a5550d4820102f0549cc87e543e9e5c..7ca81582f70d7e5a6dcfc5e02f55b40cc8f8e2d9 100644 (file)
@@ -33,5 +33,10 @@ namespace SuperPolarity
                 actor.Draw(spriteBatch);
             }
         }
                 actor.Draw(spriteBatch);
             }
         }
+
+        static public void Empty()
+        {
+            Actors.Clear();
+        }
     }
 }
     }
 }
index 8cea5c9f1e11826c569c6a5efcb701c1c613933f..006b0472de07252f28f2e2162fe4ca0c350d53a1 100644 (file)
@@ -10,8 +10,10 @@ namespace SuperPolarity
     class Screen
     {
         protected SuperPolarity Game;
     class Screen
     {
         protected SuperPolarity Game;
+        public bool Active;
         public Screen(SuperPolarity game)
         {
         public Screen(SuperPolarity game)
         {
+            Active = false;
             Game = game;
         }
 
             Game = game;
         }
 
index 04c10a4dec4095605ba6f137339e4aad1ac58458..b88741b3ecdea20e2c2b5ff202f47e2120d65ef9 100644 (file)
@@ -19,12 +19,22 @@ namespace SuperPolarity
 
         static public void Push(Screen screen)
         {
 
         static public void Push(Screen screen)
         {
+            if (Screens.Count > 0)
+            {
+                Screens.Peek().Active = false;
+            }
+
+            screen.LoadContent();
+            screen.Active = true;
             Screens.Push(screen);
         }
 
         static public void Pop()
         {
             Screens.Push(screen);
         }
 
         static public void Pop()
         {
-            Screens.Pop();
+            var screen = Screens.Pop();
+            screen.Active = false;
+            screen.CleanUp();
+            Screens.Peek().Active = true;
         }
 
         static public void Update(GameTime gameTime)
         }
 
         static public void Update(GameTime gameTime)
@@ -34,10 +44,7 @@ namespace SuperPolarity
 
         static public void Draw(SpriteBatch spriteBatch)
         {
 
         static public void Draw(SpriteBatch spriteBatch)
         {
-            foreach (Screen screen in Screens)
-            {
-                screen.Draw(spriteBatch);
-            }
+            Screens.Peek().Draw(spriteBatch);
         }
 
         internal static void SetGame(SuperPolarity game)
         }
 
         internal static void SetGame(SuperPolarity game)
index 27ea7c5b09cb3c32c906e6e4efbc5a09794cf3f2..32e8d631f81dddf11662c8c31d4eca0dc9903a91 100644 (file)
       <Link>SDL.dll</Link>
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
       <Link>SDL.dll</Link>
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
+    <Content Include="Content\Sound\bomb.wav">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Content\Sound\bullet.wav">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Content\Sound\gameover.wav">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Content\Sound\hit.wav">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Content\Sound\life.wav">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Content\Sound\polaritychange.wav">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Content\Sound\polaritytheme.wav">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
     <Content Include="Icon.ico" />
   </ItemGroup>
     <Content Include="Icon.ico" />
   </ItemGroup>
+  <ItemGroup />
   <ItemGroup>
   <ItemGroup>
-    <Folder Include="Content\Sound\" />
-  </ItemGroup>
-  <ItemGroup>
+    <None Include="Content\Fonts\bigfont.xnb">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
     <None Include="Content\Fonts\SegoeUIMono14.xnb">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
     <None Include="Content\Fonts\SegoeUIMono14.xnb">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
+    <None Include="Content\Fonts\smallfont.xnb">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
     <None Include="Content\Graphics\circle.xnb">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
     <None Include="Content\Graphics\circle.xnb">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
     <None Include="Content\Graphics\neutral-ship.xnb">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
     <None Include="Content\Graphics\neutral-ship.xnb">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
+    <None Include="Content\Graphics\pause-screen.xnb">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="Content\Graphics\polaritydemotitle.xnb">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
     <None Include="neutral-supercruiser.xnb">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
     <None Include="neutral-supercruiser.xnb">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
index 6689167f16aed7939c044b54e4fffdcc08cf1d7a..8125f8cdcea147b608d2f4b5c074bd577201cee3 100644 (file)
@@ -7,6 +7,8 @@ using Microsoft.Xna.Framework.Graphics;
 using Microsoft.Xna.Framework.Input;
 using Microsoft.Xna.Framework.Storage;
 using Microsoft.Xna.Framework.GamerServices;
 using Microsoft.Xna.Framework.Input;
 using Microsoft.Xna.Framework.Storage;
 using Microsoft.Xna.Framework.GamerServices;
+using Microsoft.Xna.Framework.Media;
+using Microsoft.Xna.Framework.Audio;
 using SuperPolarity;
 #endregion
 
 using SuperPolarity;
 #endregion
 
@@ -26,7 +28,9 @@ namespace SuperPolarity
 
         Screen EntryScreen;
 
 
         Screen EntryScreen;
 
-        SpriteFont DebugFont;
+        protected Song TitleSong;
+        protected Song GameSong;
+        protected SoundEffect GameOverSound;
 
         public SuperPolarity()
             : base()
 
         public SuperPolarity()
             : base()
@@ -43,7 +47,7 @@ namespace SuperPolarity
             ActorManager.SetGame(this);
             ScreenManager.SetGame(this);
 
             ActorManager.SetGame(this);
             ScreenManager.SetGame(this);
 
-            EntryScreen = (Screen)new GameScreen(this);
+            EntryScreen = (Screen)new TitleScreen(this);
         }
 
         /// <summary>
         }
 
         /// <summary>
@@ -60,7 +64,6 @@ namespace SuperPolarity
             InputController.Bind("fullScreenToggle", HandleFullScreenToggle);
 
             EntryScreen.Initialize();
             InputController.Bind("fullScreenToggle", HandleFullScreenToggle);
 
             EntryScreen.Initialize();
-            ScreenManager.Push(EntryScreen);
 
             OutlierBounds = 100;
         }
 
             OutlierBounds = 100;
         }
@@ -77,13 +80,17 @@ namespace SuperPolarity
         /// </summary>
         protected override void LoadContent()
         {
         /// </summary>
         protected override void LoadContent()
         {
+
+            MediaPlayer.IsRepeating = true;
+            GameSong = Content.Load<Song>("Sound\\polaritytheme.wav");
+            GameOverSound = Content.Load<SoundEffect>("Sound\\gameover");
+
             // Create a new SpriteBatch, which can be used to draw textures.
             spriteBatch = new SpriteBatch(GraphicsDevice);
 
             // Create a new SpriteBatch, which can be used to draw textures.
             spriteBatch = new SpriteBatch(GraphicsDevice);
 
-            EntryScreen.LoadContent();
+            ScreenManager.Push(EntryScreen);
 
 
-            Player = new Player();
-            DebugFont = Content.Load<SpriteFont>("Fonts\\SegoeUIMono14");
+            Player = new Player(this);
         }
 
         /// <summary>
         }
 
         /// <summary>
@@ -107,6 +114,8 @@ namespace SuperPolarity
 
             ScreenManager.Update(gameTime);
 
 
             ScreenManager.Update(gameTime);
 
+            Player.Update();
+
             base.Update(gameTime);
         }
 
             base.Update(gameTime);
         }
 
@@ -122,13 +131,25 @@ namespace SuperPolarity
 
             ScreenManager.Draw(spriteBatch);
 
 
             ScreenManager.Draw(spriteBatch);
 
-            spriteBatch.DrawString(DebugFont, "Score: " + Player.Score.ToString(), new Vector2(10, 10), Color.LightGray);
-            spriteBatch.DrawString(DebugFont, "Multiplier: " + Player.Multiplier.ToString(), new Vector2(10, 30), Color.LightGray);
-            spriteBatch.DrawString(DebugFont, "Lives: " + Player.Lives.ToString(), new Vector2(10, 50), Color.LightGray);
-
             spriteBatch.End();
 
             base.Draw(gameTime);
         }
             spriteBatch.End();
 
             base.Draw(gameTime);
         }
+
+        public void PlaySong(string songName)
+        {
+            // temp stuff before media manager is in
+            if (songName == "game")
+            {
+                MediaPlayer.Play(GameSong);
+            }
+        }
+
+        public void GameOver()
+        {
+            MediaPlayer.Stop();
+            GameOverSound.Play();
+            ScreenManager.Pop();
+        }
     }
 }
     }
 }
index 5b33218dafd278fb3e9eb5a3b61a6735f8dfa981..a953f272188d173742f00cca5ecaf67e9e32a3ec 100644 (file)
@@ -2,11 +2,49 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
 
 namespace SuperPolarity
 {
     class TitleScreen : Screen
     {
 
 namespace SuperPolarity
 {
     class TitleScreen : Screen
     {
+        protected Texture2D TitleImage;
+
         public TitleScreen(SuperPolarity newGame) : base(newGame) {}
         public TitleScreen(SuperPolarity newGame) : base(newGame) {}
+
+        public override void LoadContent()
+        {
+            base.LoadContent();
+            TitleImage = Game.Content.Load<Texture2D>("Graphics\\polaritydemotitle");
+            InputController.Bind("pause", HandleStart);
+        }
+
+        public void HandleStart(float value)
+        {
+            if (!Active) { return; }
+            Game.Player.Reset();
+            var gameScreen = new GameScreen(Game);
+            gameScreen.Initialize();
+            ScreenManager.Push(gameScreen);
+        }
+
+        public override void CleanUp()
+        {
+            base.CleanUp();
+            TitleImage = null;
+        }
+
+        public override void Draw(SpriteBatch spriteBatch)
+        {
+            base.Draw(spriteBatch);
+            spriteBatch.Draw(TitleImage, new Vector2(0, 0), Color.White);
+        }
+
+        public override void Update(GameTime gameTime)
+        {
+            base.Update(gameTime);
+            InputController.UpdateInput(false);
+        }
     }
 }
     }
 }
index 0740117ad2bb270f9ea92c73fa97d6ff6aeac3c0..15c20d018f112e09dfee1f2de15d43970b934b8d 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 b09aea142efe2a94c3cbdb89522dc98421c69200..6c1adfefd58d66f9eb00a98d2397deeaa68e79b9 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 bb51f56f0482b6f834f1c3ad05778e9762a79611..b8a1d5fe0a5049e71256b7bd88d5992577dd790e 100644 (file)
Binary files a/Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ
index e25ddab45c1ec190d651f351f1e36dff45258fe4..cabc9d20af7a9092ac363a794d00af12b1834aaa 100644 (file)
@@ -29,3 +29,14 @@ 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\square.xnb
 C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Fonts\SegoeUIMono14.xnb
 C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\neutral-supercruiser.xnb
 C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\square.xnb
 C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Fonts\SegoeUIMono14.xnb
 C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\neutral-supercruiser.xnb
+C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Sound\polaritytheme.wav
+C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Sound\bullet.wav
+C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Sound\polaritychange.wav
+C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\pause-screen.xnb
+C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\polaritydemotitle.xnb
+C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Sound\gameover.wav
+C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Sound\bomb.wav
+C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Sound\hit.wav
+C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Sound\life.wav
+C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Fonts\bigfont.xnb
+C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Fonts\smallfont.xnb
index 0740117ad2bb270f9ea92c73fa97d6ff6aeac3c0..15c20d018f112e09dfee1f2de15d43970b934b8d 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 b09aea142efe2a94c3cbdb89522dc98421c69200..6c1adfefd58d66f9eb00a98d2397deeaa68e79b9 100644 (file)
Binary files a/Super Polarity/obj/x86/Debug/Super Polarity.pdb and b/Super Polarity/obj/x86/Debug/Super Polarity.pdb differ