Time for action – player shot collisions
Add the
checkShotToEnemy()
method to theCollisionManager
class:Private Sub checkShotToEnemyCollisions() For Each shot As Sprite in _playerManager.PlayerShotManager.Shots For Each thisEnemy As Enemy in _enemyManager.Enemies If shot.IsCircleColliding( thisEnemy.EnemySprite.Center, thisEnemy.EnemySprite.CollisionRadius) Then shot.Location = offScreen thisEnemy.Destroyed = true _playerManager.PlayerScore += enemyPointValue _explosionManager.AddExplosion( thisEnemy.EnemySprite.Center, thisEnemy.EnemySprite.Velocity/10) End If Next Next End Sub
Add the
checkShotToAsteroid()
method to theCollisionManager
class:Private Sub checkShotToAsteroidCollisions() For Each shot As Sprite in _playerManager.PlayerShotManager.Shots For Each asteroid As Sprite in _asteroidManager...