]> git.r.bdr.sh - rbdr/super-polarity/commitdiff
Stuffffffff
authorBen Beltran <redacted>
Fri, 22 Nov 2013 12:53:08 +0000 (06:53 -0600)
committerBen Beltran <redacted>
Fri, 22 Nov 2013 12:53:08 +0000 (06:53 -0600)
17 files changed:
Super Polarity Content/Super Polarity ContentContent/Super Polarity ContentContent.contentproj
Super Polarity.suo
Super Polarity/ActorFactory.cs
Super Polarity/Actors/Actor.cs
Super Polarity/Actors/Bullet.cs
Super Polarity/Actors/Ship.cs
Super Polarity/Actors/StandardShip.cs
Super Polarity/BasicGenerator.cs [new file with mode: 0644]
Super Polarity/GameScreen.cs
Super Polarity/Super Polarity.csproj
Super Polarity/bin/WindowsGL/Debug/Super Polarity.exe
Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb
Super Polarity/neutral-supercruiser.xnb [new file with mode: 0644]
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

index 1aedf5318370e23b9e9c15db99eb480f880642b8..2b327e7438357bfb5f84aa4032e6afbdd51b2edb 100644 (file)
     </Compile>
   </ItemGroup>
   <ItemGroup>
-    <Folder Include="Fonts\" />
     <Folder Include="Sound\" />
   </ItemGroup>
   <ItemGroup>
       <Processor>TextureProcessor</Processor>
     </Compile>
   </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Fonts\SegoeUIMono14.spritefont">
+      <Name>SegoeUIMono14</Name>
+      <Importer>FontDescriptionImporter</Importer>
+      <Processor>FontDescriptionProcessor</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. 
index 8b2aaeabd7e5da6c7dae8e0c4d830a423dcf1d55..4f5c9c9f8f71999d547cdb59f754140724e566fa 100644 (file)
Binary files a/Super Polarity.suo and b/Super Polarity.suo differ
index 3a2dbabaa5e3a2840b31975591d2e75afcd8613f..9995707ce0cfe45a00460e363dd25161848b4ba5 100644 (file)
@@ -18,6 +18,7 @@ namespace SuperPolarity
             mainShip.Initialize(Game.Content.Load<Texture2D>("Graphics\\main-ship"), position);
 
             ActorManager.CheckIn(mainShip);
+            Renderer.CheckIn(mainShip);
 
             return mainShip;
         }
@@ -44,6 +45,7 @@ namespace SuperPolarity
             ship.SetPolarity(polarity);
 
             ActorManager.CheckIn(ship);
+            Renderer.CheckIn(ship);
 
             return ship;
         }
@@ -62,8 +64,84 @@ namespace SuperPolarity
             bullet.Angle = angle;
 
             ActorManager.CheckIn(bullet);
+            Renderer.CheckIn(bullet);
 
             return bullet;
         }
+
+        static public StandardShip CreateScout(Ship.Polarity polarity, Vector2 position)
+        {
+            StandardShip ship = new StandardShip(Game);
+            Texture2D texture;
+
+            if (polarity == Ship.Polarity.Positive)
+            {
+                texture = Game.Content.Load<Texture2D>("Graphics\\positive-scout");
+            }
+            else if (polarity == Ship.Polarity.Negative)
+            {
+                texture = Game.Content.Load<Texture2D>("Graphics\\negative-scout");
+            }
+            else
+            {
+                texture = Game.Content.Load<Texture2D>("Graphics\\neutral-scout");
+            }
+
+            ship.BoxDimensions.X = 10;
+            ship.BoxDimensions.Y = 10;
+            ship.BoxDimensions.W = 10;
+            ship.BoxDimensions.Z = 10;
+
+            ship.Initialize(texture, position);
+            ship.MaxVelocity = 5.5f;
+            ship.FleeVelocity = 6.5f;
+            ship.ChargeVelocity = 5.5f;
+            ship.Value = 3;
+            ship.HP = 0;
+            ship.AngleChangeProbability = 20;
+            ship.SetPolarity(polarity);
+
+            ActorManager.CheckIn(ship);
+            Renderer.CheckIn(ship);
+
+            return ship;
+        }
+
+        static public StandardShip CreateCruiser(Ship.Polarity polarity, Vector2 position)
+        {
+            StandardShip ship = new StandardShip(Game);
+            Texture2D texture;
+
+            if (polarity == Ship.Polarity.Positive)
+            {
+                texture = Game.Content.Load<Texture2D>("Graphics\\positive-cruiser");
+            }
+            else if (polarity == Ship.Polarity.Negative)
+            {
+                texture = Game.Content.Load<Texture2D>("Graphics\\negative-cruiser");
+            }
+            else
+            {
+                texture = Game.Content.Load<Texture2D>("Graphics\\neutral-cruiser");
+            }
+
+            ship.BoxDimensions.X = 40;
+            ship.BoxDimensions.Y = 40;
+            ship.BoxDimensions.W = 40;
+            ship.BoxDimensions.Z = 40;
+
+            ship.Initialize(texture, position);
+            ship.MaxVelocity = 0.5f;
+            ship.FleeVelocity = 5;
+            ship.ChargeVelocity = 1;
+            ship.Value = 10;
+            ship.HP = 9;
+            ship.SetPolarity(polarity);
+
+            ActorManager.CheckIn(ship);
+            Renderer.CheckIn(ship);
+
+            return ship;
+        }
     }
 }
index 8c71af080a9c677bb720941d6d7a08af6ba551ba..c3177962182beb92ccb8dfdf21d9d31bfada8c3b 100644 (file)
@@ -19,7 +19,7 @@ namespace SuperPolarity
         protected Vector2 Origin;
         public bool Active;
         public Rectangle Box;
-        protected Vector4 BoxDimensions;
+        public Vector4 BoxDimensions;
         protected Texture2D BoxTexture;
 
         // Physical Properties
@@ -29,9 +29,9 @@ namespace SuperPolarity
         public float Angle;
 
         // Constraints / Behavior
-        protected float MaxVelocity;
+        public float MaxVelocity;
         protected float AccelerationRate;
-        protected int HP;
+        public int HP;
         protected bool Immortal;
         public bool Dying;
         public int Value;
@@ -52,6 +52,10 @@ namespace SuperPolarity
         public Actor(SuperPolarity newGame)
         {
             game = newGame;
+            BoxDimensions.X = 20;
+            BoxDimensions.Y = 20;
+            BoxDimensions.W = 15;
+            BoxDimensions.Z = 15;
         }
 
         public virtual void Initialize(Texture2D texture, Vector2 position)
@@ -71,10 +75,6 @@ namespace SuperPolarity
 
             HP = 1;
             Immortal = false;
-            BoxDimensions.X = 20;
-            BoxDimensions.Y = 20;
-            BoxDimensions.W = 20;
-            BoxDimensions.Z = 20;
 
             Dying = false;
             Value = 1;
@@ -88,7 +88,7 @@ namespace SuperPolarity
 
         protected void InitBox()
         {
-            Box = new Rectangle((int)(Position.X - BoxDimensions.X), (int)(Position.Y - BoxDimensions.X), (int)(BoxDimensions.X + BoxDimensions.W), (int)(BoxDimensions.Y + BoxDimensions.Z));
+            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)
@@ -195,6 +195,10 @@ namespace SuperPolarity
 
         public void ChangeAngle()
         {
+            if (Math.Abs(Velocity.Y) <= 0.1 && Math.Abs(Velocity.X) <= 0.1)
+            {
+                return;
+            }
             Angle = (float)Math.Atan2(Velocity.Y, Velocity.X);
         }
 
index 5a7be03906268e4d677d31b5272440e6223c5a1d..6b797c2d4176e714ab4523a04e60467c9f96678a 100644 (file)
@@ -29,6 +29,7 @@ namespace SuperPolarity
             BoxDimensions.Y = 10;
             BoxDimensions.W = 10;
             BoxDimensions.Z = 10;
+            MaxVelocity = 8;
             InitBox();
             particleEngine = ParticleEffectFactory.CreateBullet(position);
         }
@@ -66,6 +67,7 @@ namespace SuperPolarity
         protected override void Die()
         {
             ActorManager.CheckOut(this);
+            Renderer.CheckOut(this);
             Parent.Children.Remove(this);
         }
     }
index 2839c9738dcebb00ac93f2501bc73ab298ee9bdb..49d0b1412f5beccd846abe76e081f117a932bd50 100644 (file)
@@ -14,9 +14,9 @@ namespace SuperPolarity
         public Polarity CurrentPolarity;
         public uint MagneticRadius;
 
-        protected float FleeVelocity;
-        protected float ActVelocity;
-        protected float ChargeVelocity;
+        public float FleeVelocity;
+        public float ActVelocity;
+        public float ChargeVelocity;
         protected int RepelRadius;
 
         protected bool Magnetizing;
@@ -25,11 +25,11 @@ namespace SuperPolarity
             MagneticRadius = 250;
             RepelRadius = 100;
 
-            HP = 5;
+            HP = 2;
 
             FleeVelocity = 5;
-            ActVelocity = 2;
-            ChargeVelocity = 1.5f;
+            ActVelocity = 1;
+            ChargeVelocity = 2.5f;
             CurrentPolarity = Polarity.Neutral;
             Magnetizing = false;
         }
index 556be0f413b5a96f5a178f37bbf2e1cbb7d9693b..ef2fe7f8116c008c17e4c209d34670373d72f0fd 100644 (file)
@@ -12,9 +12,10 @@ namespace SuperPolarity
     class StandardShip : Ship
     {
 
+        protected bool Flashing;
         protected int ChangeRate;
         protected int CurrentTime;
-        protected int AngleChangeProbability;
+        public int AngleChangeProbability;
         protected int BouncePadding;
         protected float RotationFactor;
         protected Random Random;
@@ -32,13 +33,11 @@ namespace SuperPolarity
             ChangeRate = 50;
             AngleChangeProbability = 50;
             BouncePadding = 0;
-            MaxVelocity = 1;
+            MaxVelocity = 2;
             CurrentTime = 0;
             RotationFactor = (float) (3 * Math.PI / 180);
             Random = new Random(BitConverter.ToInt32(cryptoResult, 0));
             AddingAngle = true;
-
-            HP = 5;
         }
 
         public override void Magnetize(Ship ship, float distance, float angle)
@@ -60,6 +59,16 @@ namespace SuperPolarity
             Position += Velocity;
             UpdateBox();
             Magnetizing = false;
+
+            if (Flashing)
+            {
+                Color = new Color(255, 255, 255, 128);
+                Flashing = false;
+            }
+            else
+            {
+                Color = Color.White;
+            }
         }
 
         protected void AutoMove()
@@ -131,6 +140,7 @@ namespace SuperPolarity
             {
                 var theBullet = (Bullet)other;
                 TakeDamage(theBullet.Power);
+                Flashing = true;
             }
         }
 
diff --git a/Super Polarity/BasicGenerator.cs b/Super Polarity/BasicGenerator.cs
new file mode 100644 (file)
index 0000000..7cc4544
--- /dev/null
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework;
+
+namespace SuperPolarity
+{
+    class BasicGenerator
+    {
+        public enum Ships : byte { Ship, Scout, Battlecruiser };
+
+        protected Ships ShipType;
+        protected SuperPolarity Game;
+        protected int ScoreThreshold;
+        protected int Rate;
+        protected int CurrentTime;
+        protected Random Randomizer;
+        protected Vector2 Position;
+
+        public void Initialize(SuperPolarity game, Vector2 position, Ships shipType, int rate, int scoreThreshold)
+        {
+            Game = game;
+            ShipType = shipType;
+            ScoreThreshold = scoreThreshold;
+            Rate = rate;
+            Randomizer = new Random();
+            Position = position;
+        }
+
+        public void Update(GameTime gameTime)
+        {
+            if (Game.Player.Score > ScoreThreshold)
+            {
+                CurrentTime = CurrentTime + gameTime.ElapsedGameTime.Milliseconds;
+
+                if (CurrentTime >= Rate)
+                {
+                    CurrentTime = 0;
+                    Spawn();
+                }
+            }
+        }
+
+        protected void Spawn()
+        {
+            var polarity = Ship.Polarity.Positive;
+
+            if (Randomizer.Next(2) == 1)
+            {
+                polarity = Ship.Polarity.Negative;
+            }
+
+            if (ShipType == Ships.Ship)
+            {
+                ActorFactory.CreateShip(polarity, Position);
+            }
+
+            if (ShipType == Ships.Scout)
+            {
+                ActorFactory.CreateScout(polarity, Position);
+            }
+
+            if (ShipType == Ships.Battlecruiser)
+            {
+                ActorFactory.CreateCruiser(polarity, Position);
+            }
+
+        }
+    }
+}
index 4404b16930419f27b898a6130a5200c878aa4cf3..28fd7b758d18bbd43ad10e50a46e4094faba73a4 100644 (file)
@@ -12,6 +12,8 @@ namespace SuperPolarity
     {
         public GameScreen(SuperPolarity newGame) : base(newGame) {}
 
+        private BasicGenerator generatorTest;
+
         public override void Initialize()
         {
             InputController.RegisterEventForButton("changePolarity", Buttons.A);
@@ -23,17 +25,24 @@ namespace SuperPolarity
 
         public override void LoadContent()
         {
+
+            generatorTest = new BasicGenerator();
+            generatorTest.Initialize(Game, new Vector2(100, 600), BasicGenerator.Ships.Scout, 3000, 10);
+
             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));
-            Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Positive, new Vector2(200, 200)));
-            Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Negative, new Vector2(400, 200)));
+            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));
         }
 
         public override void Update(GameTime gameTime)
         {
             InputController.UpdateInput();
             ActorManager.Update(gameTime);
+            generatorTest.Update(gameTime);
         }
 
         public override void Draw(SpriteBatch spriteBatch)
index 2cd1d08d19c72226dbc36c7610622f39775eae04..27ea7c5b09cb3c32c906e6e4efbc5a09794cf3f2 100644 (file)
@@ -39,6 +39,7 @@
     <Compile Include="ActorManager.cs" />
     <Compile Include="Actors\StandardShip.cs" />
     <Compile Include="Actors\Bullet.cs" />
+    <Compile Include="BasicGenerator.cs" />
     <Compile Include="GameScreen.cs" />
     <Compile Include="InputController.cs" />
     <Compile Include="Actors\MainShip.cs" />
     <None Include="Content\Graphics\neutral-ship.xnb">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
-    <None Include="Content\Graphics\neutral-supercruiser.xnb">
+    <None Include="neutral-supercruiser.xnb">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
     <None Include="Content\Graphics\positive-cruiser.xnb">
index 06121742b1afe35e08d410ae18e582da2295c448..0740117ad2bb270f9ea92c73fa97d6ff6aeac3c0 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 670745dc5fde2d3fc65e00263b6545f1eb8e4eb0..b09aea142efe2a94c3cbdb89522dc98421c69200 100644 (file)
Binary files a/Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb and b/Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb differ
diff --git a/Super Polarity/neutral-supercruiser.xnb b/Super Polarity/neutral-supercruiser.xnb
new file mode 100644 (file)
index 0000000..1389842
Binary files /dev/null and b/Super Polarity/neutral-supercruiser.xnb differ
index c7e2aaa2f43b033a42ba65d333bdffe6b14f5b7e..bb51f56f0482b6f834f1c3ad05778e9762a79611 100644 (file)
Binary files a/Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ
index 9c92990e5c5a7561936cafcd12c336be624e9043..e25ddab45c1ec190d651f351f1e36dff45258fe4 100644 (file)
@@ -17,7 +17,6 @@ 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\neutral-destroyer.xnb
 C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\neutral-scout.xnb
 C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\neutral-ship.xnb
-C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\neutral-supercruiser.xnb
 C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\positive-cruiser.xnb
 C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\positive-destroyer.xnb
 C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\positive-scout.xnb
@@ -29,3 +28,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\negative-ship.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
index 06121742b1afe35e08d410ae18e582da2295c448..0740117ad2bb270f9ea92c73fa97d6ff6aeac3c0 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 670745dc5fde2d3fc65e00263b6545f1eb8e4eb0..b09aea142efe2a94c3cbdb89522dc98421c69200 100644 (file)
Binary files a/Super Polarity/obj/x86/Debug/Super Polarity.pdb and b/Super Polarity/obj/x86/Debug/Super Polarity.pdb differ