Chocobreak Tutorial - Step 8
Step 8: Some sound
Our game is slowly coming into shape, but it still lacks one thing : sound! Sound adds excitement and feeling to your game. Let's make some sound when the ball bounces.
The events editor should be displayed on your screen. We are going to add new actions to the events we have previously created. First of all, let's make a sound when the ball collides with the player.
Locate the event line "Collision between BallGolden and Player", and move your mouse horizontally to the right until it reaches the position of the Sound object (speaker icon). You mouse should lay on an empty square at the intersection between that condition line, and the Sound object's column. Click with the right mouse button to open the actions menu for the Sound.
Choose the "Play sample" action. This opens the sound selector.
Click on the button "From a file / Browse", this opens a file selector. With this file selector, locate the directory where your version of Clickteam Fusion 2.5 is installed, and open the "Tutorials\ChocoBreak" folder. Several WAV files should be listed, choose the file "POP04.WAV". You can press "Play" to hear the sound. Click on OK.
We now have a new action added to the event. The event will now display like this:
You can see that when the collision condition is true, TWO actions will take place: first bouncing the ball, then playing the sound. But due to the speed of the computer, the actions will be performed simultaneously. You can now start the game. If your volume is turned up and your speakers are connected, you should now "hear" the ball bounce when it hits the player. Sound good?
Lets add some more sound, since it makes the game so much better. Since the ball also collides with the sugar objects, it makes sense to hear that happen, too. We are first going to enter the action for the first object, "SugarVertical1. Locate your mouse at the intersection between the condition "Collision between BallGolden and SugarVertical1" and the Sound object. Right click on the empty square, and click Browse in the sound selector. Now select the sound "POP1.WAV". A new action is defined for the first line.
The sound should be identical when the ball collides with any of the sugar objects. Instead of manually defining the Play Sample action for each of the lines, we are going to use drag & drop! This makes our creation much easier and faster. Move your mouse over the "Play sample POP1" action, click and hold the mouse key down to drag it. Now move the mouse to the square just below the first one : you are dragging the action with your mouse to another event line.
Now release the mouse, the action is now copied into the next line.
Repeat the same procedure and copy the action on the "Collision between BallGolden and SugarVertical2". You can "mouse over" those actions and you will see that they are identical to the original. The will play the same sound.
Now you can launch your game and enjoy the sounds. You are doing great, and look how far you have come. Take a moment to revel in what you have just created, and then we will move on to the next step.
Spread the word!
You can share this document using the following buttons.