Game Development Reference
In-Depth Information
Finally (in the Hazards group), the enemy limit sprite has a Full image bounding box,
as it is just used as an invisible barrier to enemy objects when they move about the
level.
The Icons group contains all the sprites relevant to the game's user interface (score,
lives, time, and so forth). As they are purely visual, their collision settings are
irrelevant, but they all have their Origin placed at the center for ease of reference.
The Misc (miscellaneous) group contains all of the remaining sprites in the game that
don't justify a group of their own. The first three ( spr_pickups , spr_100pts , and
spr_twinkle ) all relate to the basic collectible items on the level. These need to align
precisely with the landscape, which is determined by the tiles. You will recall that all
tiles behave as if they have Origin settings of X = 0 , Y = 0 , so these are the same origin
settings used for these sprites. Only the pickups will be collidable and they use a Full
image setting to make them as easy as possible to collect.
The exit sprite uses the Disk collision shape to create a circular collision area in the
very center of the exit.
The cloud sprites are not used for collision.
Gotta Get 'Em All
Collection is a common game mechanic in many games and Zool had collectibles by the bucket
load. Each level contained items which were appropriate to the theme of the world, so it won't
surprise you to learn that the Sweet World contained enough candy to rack up a sizable dentist
bill. Nonetheless, collectibles of this kind can serve all sorts of useful roles in level design by
providing a way to guide the player through the level and even encourage them to explore levels
to the full. Now let's set about creating the items themselves. These sweets will disappear when
Zool collides with them and be replaced by a 100pts graphic that drifts upward and then
disappears in a twinkle effect. Achieving this will require three new objects.
Creating Objects for the Level Collectibles
1.
We're going to add a lot more objects to the game in the remaining chapters, so we'll
try to keep our object resources organized by mirroring the group structure from the
sprite resources. We've already created all the empty groups for you, so it's up to you to
create each new object in the appropriate place.
Right-click on the Misc group within the Objects resource folder and select Create
Object from the menu. In this way, create three new objects within the group called
obj_collect , obj_100pts , and obj_twinkle . Give each one the sprite of the same name.
2.
Reopen obj_collect and add a Create event. Include a Change Sprite action ( main1
tab) that changes into spr_collect , but sets the Subimage to random(7) and the Speed
to 0 . If you look again at spr_collect , you will see that the sprite contains seven
separate images that are not part of an animation, as each image represents a different
kind of sweet. So this action randomly selects one of these subimages (from 0-6) and
stops the sprite from animating.
3.
Reopen obj_zool (now in the Zool group) and add a Collision event with obj_collect .
As usual, we try and handle all collisions with Zool in the Zool objects. Adding this
event to obj_zool (the parent of all the Zool states) also means that all of Zool's
different object states will inherit it.
4.
5.
Include a Play Sound action ( main1 tab) to play snd_collect .
 
Search WWH ::




Custom Search