Game Development Reference
In-Depth Information
ExpireAfterTime : The class ExpireAfterTime is used to remove an Actor after
a given number of steps. This is handy for Particles, where you want to create
them, add them to the scene, and then forget about them.
FollowActor : This class is used to keep one Actor at a fixed distant from
another Actor. This is used by the HealthBars attached to the Saucers to keep
them together.
Now that we have reviewed the core classes used to create the game Belt Commander, it is time
to look at the subclasses of the classes we just described to understand how we can extend and
customize them to create the game Belt Commander.
GameController to make our examples. To create a
BeltCommanderController . The
BeltCommanderController is responsible for managing the Actors in the game, determining the
12-9 .
Figure 12-9. Belt Commander, mid-game
In Figure 12-9 , we see the game Belt Commander. The player controls the ship on the left by tapping
the screen. The ship will move to the same height as the tap. The ship constantly fires bullets to the
right, as represented by the circle just to the lower right of the bright star in the background. From the
right, moving left, come an endless wave of asteroids. If a bullet collides with an asteroid, the asteroid
breaks into smaller parts, and the score is incremented. If an asteroid collides with the ship, the
asteroid is destroyed, but the ship's health is decremented. To add a little chaos to the game, saucers
 
Search WWH ::




Custom Search