Time for action – player collisions
Add the
checkShotToPlayerCollision()
method to theCollisionManager
class:Private Sub checkShotToPlayerCollisions() For Each shot As Sprite in _enemyManager.EnemyShotManager.Shots If shot.IsCircleColliding( _playerManager.playerSprite.Center, _playerManager.playerSprite.CollisionRadius) Then shot.Location = offScreen _playerManager.Destroyed = True _explosionManager.AddExplosion( _playerManager.playerSprite.Center, Vector2.Zero) End If Next End Sub
Add the
checkEnemyToPlayerCollisions()
method to theCollisionManager
class:Private Sub checkEnemyToPlayerCollisions() For Each thisEnemy As Enemy in _enemyManager.Enemies If thisEnemy.EnemySprite.IsCircleColliding( _playerManager.playerSprite.Center, _playerManager.playerSprite.CollisionRadius) Then thisEnemy.Destroyed = True ...