mMap.CenterCell = new Vector2(mCharacters[0].GridX, mCharacters[0].GridY);\r
#endif\r
\r
- \r
+ //Handle projectiles - update and check for wall collisions\r
for (int i = 0; i < mProjectiles.Count; i++ )\r
{\r
- mProjectiles[i].Update(timespan);\r
+ bool removed = false;\r
if (!mMap.IsCellOpen(new Point(mProjectiles[i].GridX, mProjectiles[i].GridY)))\r
{\r
\r
mProjectiles.RemoveAt(i);\r
+ removed = true;\r
i--;\r
}\r
+ if(!removed)\r
+ mProjectiles[i].Update(timespan);\r
+ \r
}\r
//Check for collisons\r
for (int j = 0; j < mCharacters.Length; j++) \r
mMap.CenterCell = new Vector2(mCharacters[0].GridX, mCharacters[0].GridY);\r
}\r
}\r
+ //Handle wall collisions of projectiles again...\r
+ for (int i = 0; i < mProjectiles.Count; i++)\r
+ {\r
+ if (!mMap.IsCellOpen(new Point(mProjectiles[i].GridX, mProjectiles[i].GridY)))\r
+ {\r
+\r
+ mProjectiles.RemoveAt(i);\r
+ i--;\r
+ } \r
+\r
+ }\r
}\r
\r
/// <summary>\r