Time for action – beginning the WeaponManager class

  1. Add a new class called WeaponManager to the Robot Rampage project.
  2. Add the following using directives to the top of the WeaponManager class file:
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Graphics;
  3. Modify the declaration of the WeaponManager class to make it a static class:
    static class WeaponManager
  4. Add declarations to the WeaponManager class:
    #region declarations
    static public List<Particle> Shots = new List<Particle>();
    static public Texture2D Texture;
    static public Rectangle shotRectangle = 
        new Rectangle(0, 128, 32, 32);
    static public float WeaponSpeed = 600f;
    
    static private float shotTimer = 0f;
    static private float shotMinTimer = 0.15f;
    #endregion
  5. Add properties to the WeaponManager ...

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.