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 the subclasses for the characters

Now, we are going to create specialized subclasses for each character. Some of them are subclasses of SpriteWrapper and others of AlienWrapper. The steps to create each subclass of AlienWrapper are very similar. However, we will discuss how to refactor the code later. This is our first intent to generalize many behaviors.

  1. Stay in the SilverlightInvaders2DVector project.
  2. Create a new class—BlueAlienWrapper (a subclass of AlienWrapper)— using the following declaration:
    public class BlueAlienWrapper : AlienWrapper
    
  3. Add the following constructor that calls the base constructor and defines the specific rotation speed for this kind of alien:
    public BlueAlienWrapper(Canvas cnvParent, Point initialLocation) ...

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