Game Development Reference
In-Depth Information
Figure 4-20.
The actions for the End Step event of the land Zool state object (part 1)
Adding Skidding
1.
Define a new constant called
SKID_SPEED
and set it to
10
(either through the
Define
Constants
option on the
Resources
menu or a new variable in the
Create
event of
obj_zool
if you are using Game Maker Lite).
Reopen
obj_zool
and select the
Draw
event. Within the grouped actions for
FACE_RIGHT
, include a new
Test Variable
action (
control
tab) to check if the
Variable
state
is
equal to
the
Value
ZSTATE_SKID
.
2.
3.
Immediately follow this with a
Draw Sprite
action (
draw
tab) to draw
spr_zool_skid_right
at a
Relative
position of
X
=
0
,
Y
=
0
.
Now use
spr_zool_skid_left
to create left-facing equivalents of these two new actions
within the grouped actions for
FACE_LEFT
.
4.
Reopen
obj_zool_land
and select the
Begin Step
event. Include a
Test Variable
action
(
control
tab) immediately before the existing
Set Variable
action. Make this check
whether the
Variable
state
is
equal to
the
Value
ZSTATE_WALK
. This will now only set
the default state to standing if the previous state was walking, as otherwise this would
interfere with skidding.
5.
Search WWH ::
Custom Search