Game Development Reference
In-Depth Information
Adding a General Solid Collision Event to the Ice State Object
1. Open obj_zool_air and select the Collision event with obj_solid . Right-click on the
list of actions and choose Select All from the menu. Right-click again and choose Copy .
2. Now reopen obj_zool_ice and add a Collision event with obj_solid . Right-click on the
empty list of actions and choose Paste .
You should now have a fairly solid slope mechanic, so give it a whirl, and if you have any
problems then you will also find this version of the game in the file zool5.gmk in the
Chapter04/Games directory on the CD. There are still some situations that you should probably
avoid when designing your own levels: placing a wall directly next to a slope will not produce
great results, for example. However, as long as you apply a bit of common sense to where you put
them, then slopes should be a great additional feature to the game.
Sound Movement
Well we're nearly there with our movement mechanics, but actually there is something really
important missing from Zool's movement—and that's sound. You might think that sound is just
an optional extra, but sounds can play a massive role in providing feedback to the player about
the game. Instant feedback is critical to creating an empowering movement mechanic and sound
is one way to supply it. Sound effects for walking, skidding, jumping, landing, grabbing, and
sliding will all add to the feeling that Zool is occupying a real, physical world that the player has
the power to control. We will begin by adding a range of sound effects that are easy to implement
and then add in a new skidding state with its own sound effect.
Adding Basic Sound Effects
1.
You'll need to begin by creating sound resources for all the sound effects, which you'll
find in the Chapter04/Resources directory on the CD. At the end of it you should have
snd_footstep , snd_skid , snd_jump , snd_ice , snd_land , snd_grab , and snd_hiya .
2.
Reopen obj_zool and select the Create event. At the start of the actions list, include a
Set Variable action ( control tab) that sets the Variable step_count to the Value 0 . We're
going to use this variable to decide how often to play some sound effects.
3.
Select the Step event and include a Set Variable action that sets the Variable
step_count Relative to the Value 1 . In this way, step_count will keep track of how many
steps there have been since Zool was first created.
4.
Reopen obj_zool_ice and select the Create event. At the start of the actions list,
include a Play Sound action ( main1 tab) to play the Sound snd_ice with Loop set to
true . This will play an icy-sounding slipping sound continually while Zool is in the ice
state.
Add a Destroy event and include a Stop Sound action to stop the Sound snd_ice . We
don't use Destroy events very often, but this will get called whenever obj_zool_ice gets
changed into another state object and stop the ice sound effect from looping (because
we have the Perform Events option checked).
5.
6.
Select the Key Press, Space event and include a Play Sound action to play the Sound
snd_jump with Loop set to false .
 
Search WWH ::




Custom Search