]> Dogcows Code - chaz/carfire/commitdiff
New property IEntity.IsCollidable so entities can let the collision code know whether...
authorCharles <Charles@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Mon, 26 Apr 2010 18:40:34 +0000 (18:40 +0000)
committerCharles <Charles@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Mon, 26 Apr 2010 18:40:34 +0000 (18:40 +0000)
git-svn-id: https://bd85.net/svn/cs3505_group@153 92bb83a3-7c8f-8a45-bc97-515c4e399668

CarFire/CarFire/CarFire/Game.cs
CarFire/CarFire/CarFire/IEntity.cs
CarFire/CarFire/CarFire/Map.cs
CarFire/CarFire/CarFire/Player.cs
CarFire/CarFire/CarFire/SaberMonster.cs
CarFire/CarFire/CarFire/Trigger.cs

index 7a1971ccdba80367241f3d78bf03137e009f9330..1486e6572a66eb31db5b6413620342eb58efe85b 100644 (file)
@@ -261,7 +261,8 @@ namespace CarFire
         public bool IsCellOpen(Point point)\r
         {\r
             if (!State.Map.IsCellOpen(point)) return false;\r
-            if (GetEntityAtCoordinates(point) != null) return false;\r
+            IEntity entity = GetEntityAtCoordinates(point);\r
+            if (entity != null && entity.IsCollidable) return false;\r
             return true;\r
         }\r
 \r
index b8121719f1aef7614764591981af146b55be8a44..e916f2a6e13c5de2e1860e724e0fa4132e771881 100644 (file)
@@ -32,6 +32,11 @@ namespace CarFire
         /// <param name="spriteBatch">The widget.</param>\r
         void Draw(SpriteBatch spriteBatch);\r
 \r
+        /// <summary>\r
+        /// Get whether or not the entity is collidable.\r
+        /// </summary>\r
+        bool IsCollidable { get; }\r
+\r
         /// <summary>\r
         /// Get the actual position.\r
         /// </summary>\r
index bc3fbbf881de75701cdb62ef5388673300ff32ab..0178e2ba7188884deceb6bc5a1432d323bebee3e 100644 (file)
@@ -134,7 +134,9 @@ namespace CarFire
         /// <summary>\r
         /// Get and set the tilemap with its associated texture and tile\r
         /// character to coordinate mappings.  This effects what the map looks\r
-        /// like when it is drawn.\r
+        /// like when it is drawn.  You will need to reset any map instances\r
+        /// after setting a new tilemap.  You should also set a tilemap before\r
+        /// instantiating any maps.\r
         /// </summary>\r
         public static Tilemap Tilemap;\r
 \r
index 02d6eec92a8838ffc9cdc365dfcd5a06e404270a..9d6c6b41499dcdd181fc0955de3b459c3b534f3d 100644 (file)
@@ -33,6 +33,7 @@ namespace CarFire
         public Game Game { get { return game; } }\r
         public MovementManager Motion { get { return mMotion; } }\r
         public int PlayerIndex { get { return mPlayerIndex; } }\r
+        public bool IsCollidable { get { return true; } }\r
         public Vector2 Position { get { return mMotion.Position; } }\r
         public Point Coordinates { get { return mMotion.Coordinates; } \r
             set\r
index 2d711a4e812159e55fbecc72092528ee58a2e8df..a3507c87f6006642655594aaa009555cbc283f1c 100644 (file)
@@ -211,6 +211,8 @@ namespace CarFire
             this.health -= amount;\r
         }\r
 \r
+        public bool IsCollidable { get { return true; } }\r
+\r
         /// <summary>\r
         /// Get the smoothed position.\r
         /// </summary>\r
index 6d639d8f343e0c80b14f504199296cc424ec492e..e405aa9fb027ca6432e977d2abe497845d4c9eeb 100644 (file)
@@ -87,6 +87,11 @@ namespace CarFire
             // No implementation needed.\r
         }\r
 \r
+        public bool IsCollidable\r
+        {\r
+            get { return false; }\r
+        }\r
+\r
         public Vector2 Position\r
         {\r
             get { return Vector2.Zero; }\r
@@ -94,7 +99,7 @@ namespace CarFire
 \r
         public Point Coordinates\r
         {\r
-            get { return new Point(-1, -1); }\r
+            get { return mCoordinates; }\r
         }\r
 \r
         #endregion\r
This page took 0.022862 seconds and 4 git commands to generate.