Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

arrow_back Crashing Sounds

Transcript

In this add-on, I'll show you how to program your two sprites to play a crashing sound if they touch.

To code this, use an “if” block. When you’re done with this step, this “if” block will read, “if touching player 2, play a sound.”

To start, click on player 1. Then, click on events and select a "when green flag clicked” block to start. Next, go to control and select a “forever loop.’’ Inside of this "forever loop," I'll put an "if" statement, which is also found in control.

Now, program this to say: If touching player 2, play a sound.

Click on Sensing, and select a "touching" block and change the value to Player 2.

Now, you need a sound!

Click on the sounds tab, and select "choose sound from library."

This example uses “scream-male1,” but you can select whatever sound you want for your project.

you can select whichever sound you want for your project.

Click the “scripts” tab, select the sound menu, and choose “play sound scream-male 1 until done.” Then, place this block in your if statement.

Now, the code reads: “Once this program starts, if player 1 touches player 2, play the male-scream sound.” Let's try it!

(chuckles) Great! Now if the two players crash into each other, a cool scream sound plays. This is a fun add-on to try with someone else, so be sure to try your game with a neighbor!

Choose an Add-On
Change Up your Racetrack
Add a button that changes the racetrack backdrop.
Costume Change
Change what the racers look like when a key is pressed.
Step on the Gas (Part 1 of 2)
Change how fast the racers move, then make them slowdown on the grass.
Step on the Gas (Part 2 of 2)
Change how fast the racers move, then make them slowdown on the grass.
Crashing Sounds
Play a crashing sound each time the racers hit each other.
Race Fans
Program a sprite to count down to the start of the race and cheer.
Color Trail
Add a colorful trail effect to the racers.
arrow_backward Back
Next arrow_forward
Instructions
  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!