]> Dogcows Code - chaz/carfire/blobdiff - CarFire/CarFire/CarFire/Ranged.cs
Split human class into Melee and ranged... probably should do some sort
[chaz/carfire] / CarFire / CarFire / CarFire / Ranged.cs
similarity index 89%
rename from CarFire/CarFire/CarFire/Human.cs
rename to CarFire/CarFire/CarFire/Ranged.cs
index 0d65d494a744cdfaf4b5a7e609af887431139200..b859cd6246fc79a1b1632b5d156e6b3dedd55b74 100644 (file)
@@ -9,7 +9,7 @@ using Microsoft.Xna.Framework.Input;
 \r
 namespace CarFire\r
 {\r
-    public class Human : IPlayer\r
+    public class Ranged : IPlayer\r
     {\r
         //The number of frames between each projectile is spawned.\r
         const int shootCoolDown = 18;\r
@@ -31,7 +31,7 @@ namespace CarFire
         int mPlayerIndex;\r
         \r
 \r
-        public Human(Game theGame, String Name, Point position, int playerIndex)\r
+        public Ranged(Game theGame, String Name, Point position, int playerIndex)\r
         {\r
             game = theGame;\r
             CharName = Name;\r
@@ -85,7 +85,22 @@ namespace CarFire
         /// that is being moved to is an open space.\r
         /// </summary>\r
         /// <param name="keysPressed">A general list of keys that are pressed. Other keys can be included but only direction keys will be used</param>\r
-        public void MovePlayer(TimeSpan timeSpan, List<Keys> keysPressed)\r
+        public void UpdateInput(TimeSpan timeSpan, List<Keys> keysPressed)\r
+        {\r
+\r
+            UpdatePosition(timeSpan, keysPressed);\r
+\r
+            if (projectileCoolDown > 0)\r
+                projectileCoolDown--;\r
+            else if (projectileCoolDown == 0)\r
+            {\r
+                if (keysPressed.Contains<Keys>(Keys.Space))\r
+                {\r
+                    Attack();\r
+                }\r
+            }\r
+        }\r
+        public void UpdatePosition(TimeSpan timeSpan, List<Keys> keysPressed)\r
         {\r
             bool moveLeft = keysPressed.Contains(Keys.Left);\r
             bool moveRight = keysPressed.Contains(Keys.Right);\r
@@ -107,15 +122,10 @@ namespace CarFire
             {\r
                 mMotion.LockUpdate(timeSpan, moveLeft, moveRight, moveUp, moveDown);\r
             }\r
-\r
-\r
-            if (projectileCoolDown > 0)\r
-                projectileCoolDown--;\r
-            else if (projectileCoolDown == 0)\r
-            {\r
-                if (keysPressed.Contains<Keys>(Keys.Space))\r
-                {\r
-                    float velocityX = 0;\r
+        }\r
+        public void Attack()\r
+        {\r
+             float velocityX = 0;\r
                     float velocityY = 0;\r
                     int startX = Coordinates.X;\r
                     int startY = Coordinates.Y;\r
@@ -144,14 +154,9 @@ namespace CarFire
                     toShoot *= projectileSpeed;\r
                     projectileCoolDown = shootCoolDown;\r
                     game.State.mDisplay.AddProjectiles(new Projectile(game, projectileModel,\r
-                        toShoot, new Point(startX, startY), mPlayerIndex));\r
-\r
-             \r
-                }\r
-            }\r
+                        toShoot, new Point(startX, startY), mPlayerIndex, damage));\r
+                \r
         }\r
-\r
-\r
         public void powerUp(int amount)\r
         {\r
             health += amount;\r
This page took 0.024924 seconds and 4 git commands to generate.