public void EnemiesCollision(CollisionTile tile) { for (int i = 0; i < enemies.Count; i++) { enemies[i].Collision(tile.Rectangle, map.Width, map.Height); } }
public void ProjectilesCollison(CollisionTile tile) { for (int i = 0; i < playerProjectiles.Count; i++) { if (playerProjectiles[i].Rectangle.Intersects(tile.Rectangle)) { explosions.Add(new Explosion(Content, playerProjectiles[i].Rectangle.X, playerProjectiles[i].Rectangle.Y)); playerProjectiles.RemoveAt(i); i--; } } for (int i = 0; i < enemyProjectiles.Count; i++) { if (enemyProjectiles[i].Rectangle.Intersects(tile.Rectangle)) { enemyProjectiles.RemoveAt(i); i--; } } if (playerProjectiles.Count > 5) { playerProjectiles.RemoveAt(playerProjectiles.Count - 1); } }