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 superclass for some characters

Now, we are going to create specialized subclasses of SpriteWrapper for each character in our game. As we have three different aliens in the game, we will create an AlienWrapper class, to group the common behavior of the aliens, and then three subclasses to take full advantage of object-oriented capabilities.

  1. Stay in the SilverlightInvaders2DVector project.
  2. Create a new abstract class—AlienWrapper (a subclass of SpriteWrapper)—using the following declaration:
    public abstract class AlienWrapper : SpriteWrapper
    
  3. Add the following protected variables (the aliens have to rotate at a certain speed):
    // The current rotation angle protected double _angle; // The rotation speed protected double _rotationSpeed; ...

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