Time for action – creating the CollisionManager class

  1. Add a new class called CollisionManager to the AsteroidBeltAssault class.
  2. Add the following using directive to the top of the class:
    using Microsoft.Xna.Framework;
  3. Add declarations to the CollisionManager class:
    private AsteroidManager asteroidManager;
    private PlayerManager playerManager;
    private EnemyManager enemyManager;
    private ExplosionManager explosionManager;
    private Vector2 offScreen = new Vector2(-500, -500);
    private Vector2 shotToAsteroidImpact = new Vector2(0, -20);
    private int enemyPointValue = 100;
  4. Add a constructor to the CollisionManager class:
    public CollisionManager( AsteroidManager asteroidManager, PlayerManager playerManager, EnemyManager enemyManager, ExplosionManager explosionManager) ...

Get XNA 4.0 Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.