Game Development Reference
In-Depth Information
Figure 4-9.
The actions for the obj_solid Collision event of the Zool wall state object
22.
Finally, add a
Step, End Step
event and include a
Check Object
action that checks if
there is
NOT
an
obj_wall
Object
at the
Relative
position
X
=
facing
,
Y
=
0
.
23.
Immediately follow this with a
Change Instance
action (
main1
tab) that will change
into
obj_zool_air
and
Perform Events
(
Destroy
and
Create
) as it does so. This makes
sure that Zool falls off the wall if it should disappear for any reason later on.
There are now a few changes we need to make to the other Zool objects to incorporate
obj_zool_wall
. First, we'll add appropriate transitions to the wall state from both the air and land
state objects. Then we need to include the sprite drawing for
ZSTATE_CLING
and
ZSTATE_CLIMB
in
the parent Zool object.
Adding State Transitions and Sprite Drawing to the Wall State Object
1.
Reopen
obj_zool_land
and select the
End Step
event. Include a new
Check Object
action (
control
tab) that checks for the
Object
obj_wall
at the
Relative
position
X
=
facing
,
Y
=
0
.
2.
Immediately follow this with a
Change Instance
action (
main1
tab) that will change
into
obj_zool_wall
and
Perform Events
(
Destroy
and
Create
) as it does so. This will
now make Zool automatically grab onto walls if there is a wall directly in front of him at
the end of a step.
Reopen
obj_zool_air
and select the
End Step
event. Directly below the
Set Gravity
action (as part of the events grouped in the block), include a new
Check Object
action
(
control
tab). This should check for the
Object
obj_wall
at the
Relative
position
X
=
facing
,
Y
=
0
.
3.
Search WWH ::
Custom Search