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.
BlueAlienWrapper(a subclass of
AlienWrapper)— using the following declaration:
public class BlueAlienWrapper : AlienWrapper
baseconstructor and defines the specific rotation speed for this kind of alien:
public BlueAlienWrapper(Canvas cnvParent, Point initialLocation) ...