For today lets add sounds to our game.
We really want sounds whenever the Ball collides with something. You can either add sounds directly to your collision event or first add the sounds to the list at the left.
If you right click sounds on the left you can then Create Sound. Choose Load Sound from the properties box that comes up and choose a sound. You can also then play the sound to try it out, add effects to the sound, and edit the sound. When you have the sound you want choose OK.
Add as many sounds as you would like to your game and then we’ll add them to our collision events.
Double click the objBall in your objects and choose the Collision Event with ObjWall. On the Main1 Tab is a Play Sound icon under sounds. Drag and drop it in the actions associated with the Collision Event. Then under sound choose the sound you would like to add. Make sure loop is set to false or the sound won’t quit playing.
Choose OK to close the properties window.
Save your file and give it a try.
Now we also want to stop the bat when it hits the wall (and play a sound then also). Double click the objBat in the Objects folder and then we will add a collision event for the bat with the wall. So add event and choose Collision and ObjWall. Drag over the Speed Horizontal (back on the Move tab) and set the hor speed to 0.
Click OK and give it a try. Don’t forget to save your game so far.
Next we’ll look at subtracting from your score if the ball hits the wall below the bat.
We’ll open the