Hardware Reference
In-Depth Information
Figure 6-4:
All the ghosts.
Figure 6-5:
he ghost dying
sequence.
Setting the Stage
Now with all the players in place, it is time to construct the stage for the action of your game.
he trick in making the game play at a reasonable speed is to try and cut down on the number
of drawing operations you have to make at each step. Basically the whole screen needs to be
redrawn between steps; however, doing this with a set of draw commands would take too much
time. To cut down on the amount of work needed, you can construct the game with three lay-
ers, or bitmaps. he lowest is the background layer, which contains all the walls of the maze and
needs to be drawn only once. he next layer up contains the pills; after they are drawn you need
to alter this layer only when a pill is eaten. Finally, the top layer is the screen, where Pie Man
and the ghosts will be plotted. So redrawing the screen consists of copying or blitting the back-
ground layer into the screen layer, blitting the pill layer into the screen layer and inally blitting
Search WWH ::




Custom Search