Time for action – using the CollisionManager class
Add the
CheckCollisions()
method to theCollisionManager
class:Public Sub CheckCollisions() checkShotToEnemyCollisions() checkShotToAsteroidCollisions() If Not _playerManager.Destroyed Then checkShotToPlayerCollisions() checkEnemyToPlayerCollisions() checkAsteroidToPlayerCollisions() End If End Sub
Add a declaration for the
CollisionManager
to theGame1
declarations area:Private _collisionManager As CollisionManager
Initialize the
CollisionManager
in theLoadContent()
method of theGame1
class, after theExplosionManager
has been initialized:_collisionManager = new CollisionManager( _asteroidManager, _playerManager, _enemyManager, _explosionManager)
In the
Game1
class'Update()
method, in theGameStates.Playing
section, add the following after theExplosionManager
is updated:_collisionManager.CheckCollisions()
Launch the game to view collision detection and explosion effects. After your...