Game Development Reference
In-Depth Information
obj_zool_wall —This state object will handle the states and behaviors relating to
moving on walls: clinging and climbing .
obj_zool_ice —This state object will handle the slipping state behavior relating to
moving on icy slopes in all different directions.
We can also attempt to draw these state objects and the relationships between them as a
guide to implementing the object behaviors (see Figure 3-6). It looks pretty frightening, doesn't
it? Don't worry—you don't need to memorize it, and the whole point of drawing a complicated
diagram like this is to help us focus on one state at a time, without worrying about how
complicated the overall structure is. It is impossible to capture the finer details of a system like
this in one diagram, but it should help us plan our general approach.
Figure 3-6. A (Finite) State Machine diagram for our implementation of Zool. Red arrows indicate collisions
and blue arrows indicate player interactions. “Supported/Not Supported” refers to whether Zool has a
platform directly below him or not
Note We are going to begin by defining a set of constants for use in our game. Just as with the Fishpod
example, you won't be able to create these constants unless you have a registered Pro version of Game
Maker 8. If you are using the Lite version of Game Maker, then you can achieve the same effect by
including Set Variable actions ( control tab) at the very start of the Create event for the parent Zool object.
Each one should have the same name and value as the constant. Unlike constants, these variables will
only be accessible in Zool objects, rather than globally (as constants are), but it makes no difference to the
rest of this example.
 
Search WWH ::




Custom Search