]> Dogcows Code - chaz/carfire/commitdiff
git-svn-id: https://bd85.net/svn/cs3505_group@112 92bb83a3-7c8f-8a45-bc97-515c4e399668
authorKyle <Kyle@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Mon, 19 Apr 2010 07:21:32 +0000 (07:21 +0000)
committerKyle <Kyle@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Mon, 19 Apr 2010 07:21:32 +0000 (07:21 +0000)
CarFire/CarFire/CarFire/Human.cs

index 8c94c297de9152bcdf999c197f7b7b717ef45751..07b4222f97a6fff7c3a0b36072ea9d27b0a24110 100644 (file)
@@ -18,13 +18,13 @@ namespace CarFire
             up,\r
             down\r
         };\r
+        //The number of frames between each square movements\r
         const int moveCoolDown = 15;\r
+        //The number of frames between each projectile is spawned.\r
         const int shootCoolDown = 10;\r
-        //Member Variables\r
         State state;\r
         String CharName;\r
         Map theMap;\r
-        int movementSpeed;\r
         int gridX;\r
         int gridY;\r
         Texture2D charModel;\r
@@ -38,8 +38,6 @@ namespace CarFire
         bool isMoving;\r
         float pixelX;\r
         float pixelY;\r
-        float nextPixelX;\r
-        float nextPixelY;\r
         int movementSteps;\r
         int movementCoolDown;\r
         float changeX;\r
@@ -58,8 +56,6 @@ namespace CarFire
             theMap = _theMap;\r
             CharName = Name;\r
             theDisplay = mDisplay;\r
-\r
-            movementSpeed = 12; // randomly set now\r
             health = 100;\r
             score = 0;\r
             visible = false;\r
@@ -68,6 +64,7 @@ namespace CarFire
             charModel = model;\r
             projectileModel = projectile;\r
             projectileSpeed = 30;\r
+            //The number of animation steps between each square movement.\r
             movementSteps = moveCoolDown -2;\r
             \r
         }\r
@@ -89,9 +86,14 @@ namespace CarFire
             return 0;\r
 \r
         }\r
-\r
+        /// <summary>\r
+        /// This method will draw a character to the screen.\r
+        /// </summary>\r
+        /// <param name="spriteBatch"></param>\r
+        /// <returns></returns>\r
         public long Draw(SpriteBatch spriteBatch)\r
         {\r
+            //If the sprite is moving there are still movement animations to do.\r
             if (isMoving && movementSteps > 0)\r
             {\r
                 movementSteps--;\r
@@ -100,6 +102,7 @@ namespace CarFire
                 Rectangle position3 = theMap.GetRectangleFromCoordinates(new Vector2(pixelX / Map.PixelsToUnitSquares, pixelY / Map.PixelsToUnitSquares));\r
                 spriteBatch.Draw(charModel, position3, Color.White);\r
             }\r
+            // If the sprite is not moving then just draw it.\r
             else\r
             {\r
                 pixelX = gridX * Map.PixelsToUnitSquares;\r
@@ -150,8 +153,7 @@ namespace CarFire
                     gridY -= 1;\r
                     movementCoolDown = moveCoolDown;\r
                     isMoving = true;\r
-                    nextPixelX = (float)(gridX * Map.PixelsToUnitSquares);\r
-                    nextPixelY = (float)(gridY * Map.PixelsToUnitSquares);\r
+                  \r
                     \r
                 }\r
                 // move upright\r
@@ -163,8 +165,7 @@ namespace CarFire
                     gridY -= 1;\r
                     movementCoolDown = moveCoolDown;\r
                     isMoving = true;\r
-                    nextPixelX = (float)(gridX * Map.PixelsToUnitSquares);\r
-                    nextPixelY = (float)(gridY * Map.PixelsToUnitSquares);\r
+                    \r
                     \r
                 }\r
                 // move downleft\r
@@ -176,8 +177,7 @@ namespace CarFire
                     gridY += 1;\r
                     movementCoolDown = moveCoolDown;\r
                     isMoving = true;\r
-                    nextPixelX = (float)(gridX * Map.PixelsToUnitSquares);\r
-                    nextPixelY = (float)(gridY * Map.PixelsToUnitSquares);\r
+                    \r
                 }\r
                 // move downright\r
                 else if (keysPressed.Contains<Keys>(Keys.Down) && keysPressed.Contains<Keys>(Keys.Right) && theMap.IsCellOpen(gridX + 1, gridY + 1))\r
@@ -188,8 +188,7 @@ namespace CarFire
                     gridY += 1;\r
                     movementCoolDown = moveCoolDown;\r
                     isMoving = true;\r
-                    nextPixelX = (float)(gridX * Map.PixelsToUnitSquares);\r
-                    nextPixelY = (float)(gridY * Map.PixelsToUnitSquares);\r
+                    \r
                 }\r
                 // move up\r
                 else if (keysPressed.Contains<Keys>(Keys.Up) && theMap.IsCellOpen(gridX, gridY - 1))\r
@@ -200,8 +199,6 @@ namespace CarFire
                     gridY -= 1;\r
                     movementCoolDown = moveCoolDown;\r
                     isMoving = true;\r
-                    nextPixelX = (float)(gridX * Map.PixelsToUnitSquares);\r
-                    nextPixelY = (float)(gridY * Map.PixelsToUnitSquares);\r
                     changeY = (float)(-Map.PixelsToUnitSquares / moveCoolDown);\r
                 }\r
                 // move down\r
@@ -213,8 +210,6 @@ namespace CarFire
                     gridY += 1;\r
                     movementCoolDown = moveCoolDown;\r
                     isMoving = true;\r
-                    nextPixelX = (float)(gridX * Map.PixelsToUnitSquares);\r
-                    nextPixelY = (float)(gridY * Map.PixelsToUnitSquares);\r
                     changeY = (float)(Map.PixelsToUnitSquares / moveCoolDown);\r
                 }\r
                 // move left\r
@@ -226,8 +221,6 @@ namespace CarFire
                     gridX -= 1;\r
                     movementCoolDown = moveCoolDown;\r
                     isMoving = true;\r
-                    nextPixelX = (float)(gridX * Map.PixelsToUnitSquares);\r
-                    nextPixelY = (float)(gridY * Map.PixelsToUnitSquares);\r
                     changeX = (float)(-Map.PixelsToUnitSquares / moveCoolDown);\r
                 }\r
                 // move right\r
@@ -239,8 +232,6 @@ namespace CarFire
                     gridX += 1;\r
                     movementCoolDown = moveCoolDown;\r
                     isMoving = true;\r
-                    nextPixelX = (float)(gridX * Map.PixelsToUnitSquares);\r
-                    nextPixelY = (float)(gridY * Map.PixelsToUnitSquares);\r
                     changeX = (float)(Map.PixelsToUnitSquares / moveCoolDown);\r
                 }\r
             }\r
This page took 0.028496 seconds and 4 git commands to generate.