Game Development Reference
In-Depth Information
Figure 6-11. The actions that make up the Draw event of obj_collect_count
24. Finally, reopen obj_controller and include a Create Instance action in its Create
event that creates an instance of obj_collect_count .
You can now place an instance of obj_exit in the room in a suitable position (in mid-air at
the end of the slope perhaps?) and check that it works correctly. Of course, nothing will happen
when you collide with the exit as we've not created an event for that. There's nowhere for Zool to
go yet, so this is something you would need to come back to when you have more levels. Finally,
for this chapter, we'll deal with health, lives, and the sad, but inevitable demise of the interstellar
dweller we've come to know and love:
Adding the Health and Lives
1.
Create a new object called obj_zool_dead ( Zool group), with the spr_zool_die_left
sprite, a Depth of -1 , and obj_zool as its Parent .
Add a Create event and include a Set Variable action ( control tab) that sets state to
ZSTATE_DEAD . We handled the drawing of Zool in his dead state back at the start of the
chapter (if you can remember back that far).
2.
Include a Set Gravity action ( move tab) that sets Gravity to 0 in Direction 0 .
3.
 
Search WWH ::




Custom Search