]> Dogcows Code - chaz/carfire/blobdiff - CarFire/CarFire/CarFire/Melee.cs
git-svn-id: https://bd85.net/svn/cs3505_group@141 92bb83a3-7c8f-8a45-bc97-515c4e399668
[chaz/carfire] / CarFire / CarFire / CarFire / Melee.cs
index 299f2e79a794b9b2e18b04081eb0239cb4b8a5a6..4c053a6a8c26a7efd14b9786ed5bb56594a12334 100644 (file)
@@ -15,6 +15,7 @@ namespace CarFire
         const int hitCoolDown = 18;\r
         const int baseHealth = 200;\r
         const int baseDamage = 30;\r
+        int coolDown;\r
         Texture2D charModel;\r
         Texture2D projectileModel;\r
         #endregion \r
@@ -23,7 +24,7 @@ namespace CarFire
         public Melee(Game theGame, String Name, Point position, int playerIndex)\r
             : base(theGame, Name, position, playerIndex, baseHealth, baseDamage)\r
         {\r
-            projectileSpeed = 8;\r
+            coolDown = hitCoolDown;\r
         }\r
         #endregion\r
 \r
@@ -46,17 +47,57 @@ namespace CarFire
 \r
         public override void Attack(List<Keys> keysPressed)\r
         {\r
-            if (hitCoolDown > 0)\r
-                hitCoolDown--;\r
-            else if (hitCoolDown == 0)\r
+            if (coolDown > 0)\r
+                coolDown--;\r
+            else if (coolDown == 0)\r
             {\r
                 if (keysPressed.Contains<Keys>(Keys.Space))\r
                 {\r
-                    \r
+                    int startX = Coordinates.X;\r
+                    int startY = Coordinates.Y;\r
+                    if (Motion.Direction == Direction.Down || Motion.Direction == Direction.LowerLeft || Motion.Direction == Direction.LowerRight)\r
+                    {\r
+                        velocityY = 1;\r
+                        startY = Coordinates.Y + 1;\r
+                    }\r
+                    else if (Motion.Direction == Direction.Up || Motion.Direction == Direction.UpperLeft || Motion.Direction == Direction.UpperRight)\r
+                    {\r
+                        velocityY = -1;\r
+                        startY = Coordinates.Y - 1;\r
+                    }\r
+                    if (Motion.Direction == Direction.Right || Motion.Direction == Direction.LowerRight || Motion.Direction == Direction.UpperRight)\r
+                    {\r
+                        velocityX = 1;\r
+                        startX = Coordinates.X + 1;\r
+                    }\r
+                    else if (Motion.Direction == Direction.Left || Motion.Direction == Direction.LowerLeft || Motion.Direction == Direction.UpperLeft)\r
+                    {\r
+                        velocityX = -1;\r
+                        startX = Coordinates.X - 1;\r
+                    }\r
+                    //Attack a monster\r
+                    if (!Game.IsCellOpen(new Point(startX, startY)))\r
+                    {\r
+                        foreach (IEntity entity in Game.State.Entities)\r
+                        {\r
+                            //See if it is a monster\r
+\r
+                            //Damage the monster\r
+\r
+                        }\r
+                    }\r
                 }\r
             }\r
 \r
 \r
+        }\r
+        public override void PlayAttackSound()\r
+        {\r
+\r
+        }\r
+        public override void PlayDieSound()\r
+        {\r
+\r
         }\r
         #endregion\r
     }\r
This page took 0.02513 seconds and 4 git commands to generate.