Game Development Reference
In-Depth Information
4.
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—but only he is traveling downward. This is actually a good feature, as
it allows him to quickly scale walls in a number of successive jumps. You should now
have seven actions in the End Step event for obj_zool_air , as shown in Figure 4-10.
Figure 4-10. The actions for the End Step event of the Zool air state object
5. Now reopen obj_zool and select the Draw event. Within the grouped actions for
FACE_RIGHT , include a new Test Variable action ( control tab) to check if the Variable
state is equal to the Value ZSTATE_CLIMB .
6. Immediately follow this with a Draw Sprite action ( draw tab) to draw
spr_zool_climb_right at a Relative position of X = 0 , Y = 0 .
7. Include another Test Variable action to check if the Variable state is equal to the
Value ZSTATE_CLING .
8. Immediately follow this with a Draw Sprite action to draw spr_zool_climb_right at a
Relative position of X = 0 , Y = 0 and a Subimage of 0 . This overrides the animating frame
of the sprite and stops it at the first frame when Zool is in the clinging state.
9. Now use spr_zool_climb_left to create left-facing equivalents of these four new
actions within the grouped actions for FACE_LEFT .
Finally, you can now run the game and you should have a crude form of wall-climbing
working. Like our first walking mechanic, it's a little rough around the edges, but don't worry, as
we're going to sort that out next.
 
Search WWH ::




Custom Search