Game Development Reference
In-Depth Information
FIGURe 5.25
Fruit mechanism
(purple) added to the
diagram
NOTE in the real
game, the algorithm
that determines when
ghosts leave their
house is quite complex.
We made it simpler
for teaching purposes.
also, the ghosts have
limited artificial intelli-
gence that governs how
they move; that doesn't
appear in our diagram
because we don't simu-
late the layout of the
maze.
Ghosts Produce Threat
The four ghosts start in the ghost house, and they enter the maze at a fixed rate of
one ghost every five iterations. Each ghost that is in the maze will produce a threat,
which we represent as a black resource generated by an automatic source. Figure 5.26
represents these mechanics. In this diagram, the Maze pool pulls one ghost every
five iterations. Each ghost in the maze increases the output of the source that pro-
duces the threat. The player has a chance to lower the threat by clicking the random
interactive Evade gate. When clicked, it has a 50% percent chance of triggering a
drain that drains nine threat resources. (If this fails, the Evade gate does nothing, but
the player may click it again to try again.) We arbitrarily chose this value to indicate
that trying to evade the ghosts doesn't always work. If you wanted to change the
diagram to represent a more skilled player, you could increase this percentage.
FIGURe 5.26
Ghosts create threat
but can be evaded.
Capture and loss of life
When the number of threat resources in the Threat pool passes 100, Pac-Man is
caught, and the player loses a life ( Figure 5.27 ). In the meantime, the ghosts return
to the ghost house, and the player can start again, unless it was his last life in which
case the game is over. This process is represented by an automatic trigger (the black
dotted line) that is activated when the number of threat resources passes the thresh-
old of 100. It goes to a Reset gate, which passes the trigger on in three directions
 
Search WWH ::




Custom Search