Time for action – player shot collisions
Add the
checkShotToEnemy()
method to the CollisionManager class:private void checkShotToEnemyCollisions() { foreach (Sprite shot in playerManager.PlayerShotManager.Shots) { foreach (Enemy enemy in enemyManager.Enemies) { if (shot.IsCircleColliding( enemy.EnemySprite.Center, enemy.EnemySprite.CollisionRadius)) { shot.Location = offScreen; enemy.Destroyed = true; playerManager.PlayerScore += enemyPointValue; explosionManager.AddExplosion( enemy.EnemySprite.Center, enemy.EnemySprite.Velocity/10); } } } }
Add the
checkShotToAsteroid()
method to the CollisionManager class:private void checkShotToAsteroidCollisions() { foreach (Sprite shot in playerManager.PlayerShotManager.Shots) { foreach (Sprite asteroid in asteroidManager.Asteroids...