Game Development Reference
In-Depth Information
Adding the Create Event for the Walking State Object
1. Reopen the Object Properties for obj_pod_walking .
2. Click on the Add Event button and select the Create event.
3. Include a Test Variable action ( control tab). Type facing into Variable , FACE_LEFT into
Value , and leave Operation set to equal to . This checks to see whether the character is
facing left and only performs the next actions if this is true.
4. Include a Start Block action ( control tab). This indicates the start of a block of actions
grouped together so that all of them (not just the first) depend on the result of the
previous test.
5. Include a Change Sprite action ( main1 tab) and choose the spr_pod_walk_left sprite.
Leave the other settings as they are.
6. Include a Speed Horizontal action ( move tab) and set the Hor. Speed to -2 .
7. Include an End Block action ( control tab). This indicates the end of a block of actions
that are grouped together.
8. Repeat steps 3-7 testing for FACE_RIGHT , changing the Sprite to spr_pod_walk_right ,
and setting the Hor. Speed to 2 .
You should now have a set of ten actions for the Create event that looks like the one shown in
Figure 2-13. The next step is to handle the transition from the walking state back to the standing
state (refer back to Figure 2-9). The animations for Fishpod have been designed to depict a single
hop, which would look odd if it was interrupted mid-flight, so there are going to be no Keyboard
events for the walking state. Instead, Fishpod will return back to the standing state at the end of
each walking animation loop, so that the player can control him again between hops. The
Animation End event is triggered when the current sprite animation reaches its final frame, so
this is the event we will use for the state transition.
Figure 2-13. The Create event actions for the walking state object
 
Search WWH ::




Custom Search