Time for action – building the Player class
Add a new class called "Player" to the Robot Rampage project.
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;
Modify the declaration of the Player class to make it a static class:
static class Player
Add declarations to the Player class:
#region Declarations public static Sprite BaseSprite; public static Sprite TurretSprite; #endregion
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) { int frameWidth = baseInitialFrame.Width; int frameHeight = baseInitialFrame.Height; BaseSprite = new Sprite( worldLocation, texture, baseInitialFrame, Vector2.Zero); BaseSprite...