Game Development Reference
In-Depth Information
Figure 4-15.
The faster Zool is traveling, the further up or down he needs to be moved in order to place him
back on the ramp's surface
Include a
Move to Contact
action (
move
tab) with
Direction
set to
270
,
Maximum
set
to
-1
, and
Against
set to
all objects
. This will bring Zool back down in contact with the
ramp.
2.
3.
Select the
End Step
event and delete the
Change Instance
action that changes into the
obj_zool_air
when there is no platform one pixel beneath Zool's feet. Every time Zool
walks forward on a descending ramp, he will find himself with no platform beneath his
feet, so we need to be more careful about this test.
4.
Include a
Start Block
action in its place (
control
tab) to group together the following
actions that will now depend on there being no platform directly beneath Zool's feet.
Follow this with a
Check Object
action that checks for the
Object
obj_platform
, at a
Relative
position of
X
=
0
,
Y
=
speed
. This checks to see if there is actually a platform
(which includes ramps) a little bit further below Zool's feet. The distance depends on
his speed, as the faster he is moving, the further above the ramp he could be (see
Figure 4-15).
5.
Follow this with a
Move to Contact
action (
move
tab) with
Direction
set
to
270
,
Maximum set to
6.
-
1
, and
Against
set
to
all objects
. This will bring Zool back down on
top of the ramp.
7.
Follow this with an
Else
action (
control
tab).
8.
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 will start
Zool falling if
he isn't traveling down a ramp
.
9.
Follow this with an
End Block
action (
control
tab). The End Step event should now
have nine actions, as shown in Figure 4-16.
Search WWH ::
Custom Search