Time for action – player collisions
Add the
checkShotToPlayerCollision()
method to the CollisionManager class:private void checkShotToPlayerCollisions() { foreach (Sprite shot in enemyManager.EnemyShotManager.Shots) { if (shot.IsCircleColliding( playerManager.playerSprite.Center, playerManager.playerSprite.CollisionRadius)) { shot.Location = offScreen; playerManager.Destroyed = true; explosionManager.AddExplosion( playerManager.playerSprite.Center, Vector2.Zero); } } }
Add the
checkEnemyToPlayerCollisions()
method to the CollisionManager class:private void checkEnemyToPlayerCollisions() { foreach (Enemy enemy in enemyManager.Enemies) { if (enemy.EnemySprite.IsCircleColliding( playerManager.playerSprite.Center, playerManager.playerSprite.CollisionRadius)) { enemy.Destroyed = true; explosionManager...