Game Development Reference
In-Depth Information
Figure 4-19.
The actions for the End Step event of the ice Zool state object
29.
Add a
Collision
event with
obj_slope
and include a
Set Variable
action to set the
Variable
y
Relative
to
-speed*2
.
30.
Include a
Move to Contact
action (
move
tab) that sets
Direction
to
270
,
Maximum
to
-1
, and
Against
to
all objects
. This will bring Zool back down in contact with the slope.
31.
Add a
Key Press, Space
event and include a
Speed Vertical
action that sets
Vert. Speed
to
-22
. Jumping is the player's only way of controlling the slide
.
32.
Include a
Change Instance
action (
main1
tab) that will change into
obj_zool_air
and
Perform Events
(
Destroy
and
Create
) as it does so.
If you spend a little time on the slopes now, you should see that we've already nearly got this
cracked. There is just one bug: if you jump back up the slope and manage to slide up to the top
and back onto a non-slippery platform, then you will get stuck. This is because we have not
handled collisions with other kinds of solid objects. We would really like this to have the same
sliding behavior as the
obj_zool_air
object because it would look quite strange to suddenly come
to a halt at the bottom of a slope. Therefore, we will copy the actions of that event and use it for
this one.
Search WWH ::
Custom Search