Game Development Reference
In-Depth Information
Exciting, huh? OK, so this game is not going to win any awards, but it's the basis of much bigger
things. It includes the three core parts of our game framework that we discussed earlier and a
couple more gems that might not be obvious at first. For example, notice, in the gameOver
function, that we remove the mouse click event listener. It is good practice to always clean up
your event listeners. A very common source of memory leaks in AS3 is event listeners that are
not removed. If you don't remove listeners, you will find that your games run slower the longer
they are played. If you build those basics correctly at the beginning, you'll find your life will be
much easier later on when your games get more complex.
Your Second Game: Balloon Saw
So now that you have completed a very simple first game, let's use those ideas to create an
actual game: your second game . Balloon Saw is a game in which the player controls a spinning
blade and tries to pop as many balloons as possible. If the player misses 5 balloons, the game is
over. We will expand the previous game framework for this project.
Assets for this game
We will discuss ideas on creating your own assets for your games later in this topic, so for now,
we will just describe what we will be using to create Balloon Saw.This might be a good time to
download the code for the topic from the web address printed on the back cover. You can find
these assets in /source/projects/ch1_balloons/ballons.fla .
Graphics
We need only three graphical assets for this game, and all are MovieClip s in the .swf library:
enemy : The “enemies” in this game are balloons. This MovieClip contains five frames,
each with a differently colored balloon on a keyframe. The colors are red, blue, green,
yellow, and purple. Figure 1-3 shows this asset.
Figure 1-3. The enemy MovieClip
Search WWH ::




Custom Search