Game Development Reference
In-Depth Information
Table 8-1. Continued
Name and file
What it does
Symbol name :
Instance name :
Class file :
This is the player's health meter. It's reduced by one
each time the player touches one of the enemies.
When it falls below one, the GameOver screen is
displayed and tells the player that the game has
been lost.
Symbol name :
Instance name :
Class file :
The C]iaKran symbol is a 550-by-400 white rectangle
with a dynamic text field called iaoo]ca@eolh]u. It's
displayed at the end of the game and tells the player
whether the game has been won or lost.
Symbol name :
Instance name :
Class file :
The Library also contains a symbol called DungeonTwo.
It exists to show you how you can add a new level to
the game if you continue building it. Later in the chap-
ter I'll show you how to do this.
Animating with the timeline
Before you start looking at the code for this game, you'll learn how the enemy objects were made. The
enemy objects are animated using the timeline. Flash was originally designed as animation software,
and there's no reason why you shouldn't use some of its excellent built-in tools to easily add anima-
tion to the game. Although it's often preferable to animate game objects using pure AS3.0 code, you'll
find that doing the animation manually is often a more straightforward approach.
In this next section, I'll give you step-by-step directions for creating these enemies. If you want to cre-
ate animated objects for your own games, you can use these instructions as a general model.
Creating the enemies
Before you can start animating, you need to make sure that the enemy objects are set up properly.
The first thing you need to understand is that the animation is happening in the timeline of the enemy
objects themselves . The objects are not being animated on the @qjcakjKja timeline.
For this to work properly, the AjaiuKja and AjaiuPsk symbols need to be containers for two other
symbols: AjaiuKja[Oq^K^fa_p and AjaiuPsk[Oq^K^fa_p. These two subobjects will contain the actual
graphic design of your enemies and will be animated inside the AjaiuKja and AjaiuPsk Movie Clip
symbols. When that's done, you can drag instances of AjaiuKja and AjaiuPsk into @qjcakjKja, along
with the rest of your objects.
Search Nedrilad ::

Custom Search