O'Reilly logo

XNA 4.0 Game Development by Example Beginner's Guide by Kurt Jaegers

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - building the Player class

  1. Add a new class called "Player" to the Robot Rampage project.
  2. Add the following using directives to the top of the Player class file:
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Graphics;
    using Microsoft.Xna.Framework.Input;
    
  3. Modify the declaration of the Player class to make it a static class:
    static class Player
    
  4. Add declarations to the Player class:
    #region Declarations
    public static Sprite BaseSprite;
    public static Sprite TurretSprite;
    #endregion
    
  5. Add the Initialize() method to the Player class:
    #region Initialization public static void Initialize( Texture2D texture, Rectangle baseInitialFrame, int baseFrameCount, Rectangle turretInitialFrame, int turretFrameCount, Vector2 worldLocation) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required