Fine-Tuning Gameplay

With any game that you develop, you will want to tweak things during game testing to ensure that the game plays the way that you intend and is challenging but fun at the same time. The biggest factor is to make sure that the game is entertaining to play. If you're just making the game for yourself, that will obviously be your call. If, however, you're developing it for a wider audience, it's important to get feedback from that user base sooner rather than later.

In this case, one thing you might want to tweak is related to the mouse movement that you've built into the game. You may have noticed that playing with the mouse is much easier than playing with the keyboard keys. To make the game more challenging and to force the user to use an input form that maintains a constant speed for the player sprite, try removing mouse support (I'd recommend leaving support for the gamepad and keyboard input in place).

To remove support for the mouse, comment out or delete the mouse-movement code located in the Update method of the UserControlledSprite class:

// COMMENTED-OUT MOUSE SUPPORT
// If the mouse moved, set the position of the sprite to the mouse position
// MouseState currMouseState = Mouse.GetState(  );
// if (currMouseState.X != prevMouseState.X ||
//     currMouseState.Y != prevMouseState.Y)
// {
//     position = new Vector2(currMouseState.X, currMouseState.Y);
// }
// prevMouseState = currMouseState;

You should also comment out the class-level prevMouseState variable in ...

Get Learning XNA 3.0 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.