This tutorial covers:
This lab is like the previous lab, except for that you will use the XBox 360 controller for input. The following controls should have the following actions:
Back button: exit game
This has been implemented for you as a small example of accessing the controller state.
D-Pad Up: forward
D-Pad Down: backward
Right thumbstick: ship orientation
Even when not in use, the thumbstick input can be non-zero. Use a "dead zone" to make sure that near-zero input is treated as zero.
Either bumper: turn on shields
In order to understand how to access and use the controller state,
look at the various items in the
Microsoft.Xna.Framework.Input namespace.
One thing that might not be immediately obvious from the documentation is that
GamePadDeadZone.WHATEVER is used as an optional parameter to
GamePad.GetState().
Although not required, you are encouraged to embellish the controls above. Also, while a ship image is provided, feel free to substitute your own. Presumably, you'll just use the same ship and shield images you used in the previous lab.
The framework can be downloaded here. Once again, we suggest that you simply modify the XboxGame.cs and Ship.cs files. Note that World.cs provides code for matrix operations, that you may use for translations and such.