arrow_back Play a Sound if Caught
Games often use sound effects to increase excitement. In this screencast, you will learn how to add sound to your game that will play if the chaser catches the player. Watch this screencast to learn how to add sound, then try it on your own.
To start, click on Chaser 1, then the sounds tab. Select “choose sound from library.”
Test a few sounds by clicking on the play buttons.
Once you’ve found a sound you’d like your game to play when a chaser catches the player, select it and click “OK.”
Great! Now your project has sound, but, you still need to create the code that will tell the computer when to play it.
In a previous screencast, you programmed an if statement to sense if the chaser was touching the player. You can use this same if statement to play the sound you just picked.
Click on the scripts tab, and click on Sound.
Drag out a "play sound" block from the sound menu, and place it in your block stack before the "say" block that makes the chaser say the time left in the game.
Remember, in computer science it’s important to test your code often to make sure it’s working the way you want. Test your code now.
[screeching sound] When the chaser catches the player, the sound you chose should play.
[screeching sound] Now, it’s your turn. Be creative and have fun adding sounds to your Scratch project!
If you get stuck along the way, ask your neighbor for help or put up your sticky to get the attention of your CS First Guru.