Game Development Reference
In-Depth Information
4.
Right-click anywhere in the actions list and choose Paste from the menu. All four
actions from obj_pod_walking should be copied over.
5.
Drag the Move Fixed action ( move tab) into the actions list before the Change
Instance action. Select the middle Directions button to indicate no direction of
moment and leave the Speed set to 0 .
6.
Double-click the Change Instance action in the actions list to reopen it. Change the
Change Into option to obj_pod_falling .
Note Although we told you to put the Move Fixed action before the Change Instance in the previous
instructions, it doesn't actually make any difference if you put it at the end of the actions list in this case.
This is because after the Change Instance action is called (along with the appropriate Create event of the
object it is changing into), Game Maker will come back and finish off any remaining actions in this event.
Nonetheless, in principle, we want the Create event called by the Change Instance action to override any
previous settings, so we make sure that it is last in the list.
Actually, you may think it's a bit strange that we always change into the falling state when an
instance of the jumping object collides with a platform. There are actually two different situations
in which this collision might occur. The first is when Fishpod neatly jumps onto a platform's
surface, and the second is when it collides with the underside of a platform. Both cases are neatly
handled by the Move to Contact action with the direction variable. However, you might expect
the first to result in a change to obj_pod_standing and the second in a change to obj_pod_falling .
Indeed, we could test the direction variable and make the appropriate choice, but this is
unnecessary. Once in the falling state, it will get back to the standing state within a couple of
steps anyway through its own state transitions.
Finally we will handle the Animation End event, which just needs to switch from the rotating
jumping animation into the static falling animation at the end of one full rotation.
Adding an Animation End Event for the Jumping State Object
1.
Add an Other, Animation End event to obj_pod_jumping .
Include a Change Instance action ( main1 tab) that changes into obj_pod_falling and
set Perform Events to yes .
2.
 
Search WWH ::




Custom Search