Game Development Reference
In-Depth Information
Figure 4-12. The actions for the Keyboard, Up event of the Zool wall state object
12. Now select the End Step event and include a Check Object action that checks if there is
NOT an obj_wall at the Relative position X = facing , Y = -20 . If there isn't a wall at this
position, then Zool's upper body is above the top of the wall. Although the Keyboard,
Up event in the previous step will stop Zool from moving up into this position, he
could still jump into a wall and cling on in this unrealistic position without this check.
13. Include a Jump to Position ( Move tab) that moves Zool to a Relative position of X = 0 ,
Y = 5 . This will make him slide back down again until his hands appear to grab onto the
top of the wall. Note that we are only checking 20 pixels above Zool to trigger the slide
down, which is not quite as far as the 22 pixels that triggers the automatic jump in the
Keyboard, Up event. This is because we don't want the slide down to happen before
the jump up when Zool is climbing up a wall.
14. Next, we're going to allow Zool to walk away from walls without needing to jump. Add
a Keyboard, Left event and include a Test Variable action ( control tab) that tests if the
Variable facing is equal to FACE_RIGHT .
15. Immediately follow this with a Check Object action that checks to see if there is an
obj_platform at a Relative position of X=
0
1
. He should only be able to walk off a
wall when there is a platform directly below his feet.
16. Include a Start Block action.
17. Include a Set Variable action that sets the Variable facing to the Value FACE_LEFT .
18. Include a Change Instance action ( main1 tab) that will change into obj_zool_land and
Perform Events ( Destroy and Create ) as it does so.
19. Include an End Block action ( control tab). The Keyboard, Left event should now
contain six actions, as shown in Figure 4-13.
, Y=
 
Search WWH ::




Custom Search