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 methods for the game loop

Firstly, we are going to create many new methods in the MainPage class for creating the sprites using the SpriteWrapper subclasses, animate them, and control some of their actions. Then, we will be able to write a complex game loop:

  1. Stay in the SilverlightInvaders2DVector project.
  2. Open MainPage.xaml.cs and add the following lines to define private variables in the public partial class MainPage : UserControl:
    // The aliens private List<AlienWrapper> _aliens; // The total number of tents private int _totalTents = 4; // The total number of rows and cols for the aliens private int _totalRows = 5; private int _totalCols = 11; // The four tents private List<TentWrapper> _tents; // The ship private ShipWrapper ...

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