Game Development Reference
In-Depth Information
Figure 3-7.
The current state of the Draw event for the parent Zool object
Note
If you run the game at the moment, it will exit immediately. Why is this? Well, if you think about it,
the
Create
event of
obj_zool
changes the instance into
obj_zool_land
, performing the
Destroy
and
Create
events of
obj_zool
and
obj_zool_land
, respectively. Yet,
obj_zool_land
inherits its
Create
event from
obj_zool
, so its
Create
event will also change the instance into
obj_zool_land
. This sets an
infinite loop in motion, and Game Maker aborts the program.
■
The Zool Land State Object
1.
Reopen
obj_zool_land
and add a
Create
event. Include a
Set Variable
action (
control
tab) that sets a variable
state
to
ZSTATE_STAND
.
Include a
Set Gravity
action (
move
tab) that sets
Direction
to
270
(downward) and
Gravity
to
0
(off). All the land-based movement will work with gravity turned off, as it
makes things simpler that way.
2.
Search WWH ::
Custom Search