Game Development Reference
In-Depth Information
Wall Polish
We're going to need to make some serious improvements to the climbing mechanic before it's as
slick as Zool's movement on land and in the air. For a start, it's really easy to grab onto a wall, but
a bit of a pain getting detached again. He appears to cling on to thin air at the top or bottom of
walls and you're forced to jump off awkwardly in order to get free. It's also annoying when he
accidently slides into a wall while walking in one direction, but then is forced to jump off again
before he can walk back in the other. These are all fairly minor issues to fix, but will drastically
improve the responsiveness of Zool's controls. They will involve a few changes to the keyboard
events, so we'll begin with those.
Improving Detachment for the Zool Wall State Object
1.
Reopen
obj_zool_wall
and select the
Keyboard, Down
event. Include an
Else
action
(
control
tab) at the end of the actions list. This adds a separate condition for when Zool
is climbing down and there is no longer an
obj_wall
below and in front of him.
2.
Include a
Start Block
action. It's not strictly necessary, as we will only be including one
action, but it looks neatest as we used a block further above.
Include a
Change Instance
action (
main1
tab) that will change into
obj_zool_air
and
Perform Events
(
Destroy
and
Create
) as it does so.
3.
4.
Include an
End Block
action (
control
tab).
5.
Now select the
Keyboard, Up
event. Edit the
Check Object
action (
control
tab) that
checks for the
Object
obj_wall
and change the
Y
setting from
-4
to
-22
. We know
from earlier that Zool's bounding box extends 18 pixels above his origin and that he
climbs at 4 pixels per step. Therefore, this test will make sure that Zool only moves
up if his bounding box would not extend beyond the top of the wall after moving (see
Figure 4-11).
Search WWH ::
Custom Search