Real races, often have dramatic crashes.
In this add-on, you'll program the sprites
to play a crashing sound if they touch.
To start, program player one to continually check
if it's touching player two after the flag is clicked.
Select player one.
Then from events, add a one flag quick block.
From control, add a forever loop,
and in this add a if then block.
To make player one play a sound if it touches player two,
click sensing, and add a touching block.
Change the value to player two.
Next, add a sound.
Click the sounds tab, and select to sound from library.
You can select whichever sound you want for your project.
(screaming)
Select the sound menu,
and drag out a play sound until done block.
Place this block in if statement,
and change the drop down to the sound you selected.
Now, the code reads, when the program starts,
if player one touches player two, play a sound.
Test your coded by clicking the flag.
(player one screaming)
(player one screaming)
(player one screaming)
(player one screaming)
(player one screaming)
Great.
Now, if the two players crash into each other,
a scream sound plays.
This is a fun feature to play with someone else,
so ask your neighbor to play your game.
Now it's your turn.
Program the player one sprite to check
if it's touching player two,
using an if touching forever, and one flag quick blocks.
Then, add a sound effect from the scratch library,
using a play sound until done block.