O'Reilly logo

3D Game Development with Microsoft Silverlight 3 Beginner's Guide by Gastón C. Hillar

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—creating a keyboard manager class

Your project manager wants you to go back to the Invaders 2D game that you had submitted to the game contest website. Many players reported bugs and said that they could not use a gamepad to play the game. Remember that it was the most desired game.

The code that checks the keyboard is taking into account just one pressed key. It is time to create a keyboard manager class. It must be able to track multiple keys pressed by the user between each rendered frame:

  1. Open the SilverlightInvaders2DVector project.
  2. Create a new class—KeyboardManager.
  3. Add the following line of code at the beginning of the class definition (as we are going to use the System.Collections.Generic.List class):
    using System.Collections.Generic; ...

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