]> Dogcows Code - chaz/carfire/commitdiff
Rearranged stuff to make scoring work.
authorKyle <Kyle@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Thu, 22 Apr 2010 23:42:55 +0000 (23:42 +0000)
committerKyle <Kyle@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Thu, 22 Apr 2010 23:42:55 +0000 (23:42 +0000)
git-svn-id: https://bd85.net/svn/cs3505_group@132 92bb83a3-7c8f-8a45-bc97-515c4e399668

CarFire/CarFire/CarFire/Game.cs
CarFire/CarFire/CarFire/Human.cs
CarFire/CarFire/CarFire/Projectile.cs

index 445336a0e6f79f865f98d4d5e5c511d8a884d1ee..4aa1cfe83aff7eea3d60f74d2289042d66cd34b7 100644 (file)
@@ -232,7 +232,6 @@ namespace CarFire
 \r
 \r
         #region Public Methods\r
-\r
         public bool IsCellOpen(Point point)\r
         {\r
             if (!State.Map.IsCellOpen(point)) return false;\r
@@ -385,7 +384,7 @@ namespace CarFire
                     allCharactersSelected = false;\r
                     if (State.GetKeysDown(i).Contains(Keys.Enter))\r
                     {\r
-                        State.mCharacters[i] = new Human(this, "", State.Map.GetStartingPositionForPlayer(i + 1));\r
+                        State.mCharacters[i] = new Human(this, "", State.Map.GetStartingPositionForPlayer(i + 1), i);\r
                         State.mCharacters[i].LoadContent(mContentManager);\r
                     }\r
                 }\r
index 3897491da0305896fb6674f3f13f08f0261282f1..0d65d494a744cdfaf4b5a7e609af887431139200 100644 (file)
@@ -28,9 +28,10 @@ namespace CarFire
         //Used to draw projectiles\r
         int projectileSpeed;\r
         int projectileCoolDown;\r
+        int mPlayerIndex;\r
         \r
 \r
-        public Human(Game theGame, String Name, Point position)\r
+        public Human(Game theGame, String Name, Point position, int playerIndex)\r
         {\r
             game = theGame;\r
             CharName = Name;\r
@@ -38,6 +39,7 @@ namespace CarFire
             score = 0;\r
             visible = false;\r
             projectileSpeed = 8;\r
+            mPlayerIndex = playerIndex;\r
 \r
             // Speed is the number of grid cells you can move through per second.\r
             mMotion = new MovementManager(position, 4.0f);\r
@@ -141,8 +143,8 @@ namespace CarFire
                     toShoot.Normalize();\r
                     toShoot *= projectileSpeed;\r
                     projectileCoolDown = shootCoolDown;\r
-                    game.State.mDisplay.AddProjectiles(new Projectile(game.State.Map, projectileModel,\r
-                        toShoot, new Point(startX, startY)));\r
+                    game.State.mDisplay.AddProjectiles(new Projectile(game, projectileModel,\r
+                        toShoot, new Point(startX, startY), mPlayerIndex));\r
 \r
              \r
                 }\r
index 3f5b1368466a9496318ae47a3b63a86d315ff388..6603272c2f84ea9655d965c35ff8e5be1437cee3 100644 (file)
@@ -15,7 +15,6 @@ namespace CarFire
     public class Projectile\r
     {\r
         //Member Variables\r
-        Map theMap;\r
         Vector2 velocity;\r
         Texture2D projectileModel;\r
         int damage;\r
@@ -27,6 +26,8 @@ namespace CarFire
         int pixelY;\r
         MovementManager mMotion;\r
         Point mPosition;\r
+        int mCharacterIndex;\r
+        Game mGame;\r
 \r
         /// <summary>\r
         /// The Constructor for a projectile object.\r
@@ -38,13 +39,15 @@ namespace CarFire
         /// <param name="_gridY">The starting Y position in the map grid</param>\r
         /// <param name="_pixelX">The absolute X pixel position on the map</param>\r
         /// <param name="_pixelY"> The absolute Y pixel position on the map</param>\r
-        public Projectile(Map _currentMap,\r
+        public Projectile(Game theGame,\r
                             Texture2D _projectileModel,\r
                             Vector2 _velocity,\r
-                            Point _position)\r
+                            Point _position,\r
+                            int characterNumber)\r
                 \r
         {\r
-            theMap = _currentMap;\r
+            mGame = theGame;\r
+            mCharacterIndex = characterNumber;\r
             projectileModel = _projectileModel;\r
             velocity = _velocity;\r
             mPosition = _position;\r
@@ -79,7 +82,7 @@ namespace CarFire
         /// <param name="topLeftY">The map Y pixel position of the topLeft of the display</param>\r
         public void Draw(SpriteBatch spriteBatch)\r
         {\r
-            Rectangle position = theMap.GetRectangleFromCoordinates(mMotion.Position);\r
+            Rectangle position = mGame.State.Map.GetRectangleFromCoordinates(mMotion.Position);\r
             spriteBatch.Draw(projectileModel, position, Color.White);\r
          \r
         }\r
@@ -91,7 +94,6 @@ namespace CarFire
         public int GridY { get { return gridY; } set { gridY = value; } }\r
         public int PixelX { get { return pixelX; } set { pixelX = value; } }\r
         public int PixelY { get { return pixelY; } set { pixelY = value; } }\r
-        public Map TheMap { get { return theMap; } set { theMap = value; } }\r
         public int Damage { get { return damage; } set { damage = value; } }\r
         public Vector2 Position { get { return mMotion.Position; } }\r
         public Point Coordinates { get { return mMotion.Coordinates; } }\r
This page took 0.030494 seconds and 4 git commands to generate.