(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Make your sprite jump when you clap is a video in a series of video tutorials under the Help tab on the Scratch main head bar. It describes how to use the loudness value to make a sprite jump. The video is 2 minutes and 6 seconds long.

## Transcription

[0:00] In this video, we will make our sprite jump every time we clap our hands. clap, clap.

[0:08] To make this work, you will need a microphone.

[0:11] Now, to make our cat jump, we really need to change it's position in the vertical position, or the y axis.

[0:18] To do this, I will grab the set y block.

[0:24] Now I want this y value to change every time I clap my hands, so I will click on the Sensing Link in the blocks palette...

[0:38] ...and grab the loudness block.

[0:45] Loudness uses the microphone in your computer to detect the volume of the sounds you are making. I will set loudness to the y value to our cat.

[0:55] Now I want my program to run repeatedly, so I will grab the forever block and I want also want this program to run after I hit the green flag, so I will click that block also.

```when gf clicked
forever
set y to (loudness)
end
```

[1:05] When you click on the green flag, Scratch may request your permission to access you computer's microphone. Click allow.

[1:15] Now when you clap your hands, the cat will jump.

[1:21] To make these jumps a bit more pronounced, I will click the Operators link in the palette...

[1:32] ...and grab the multiplication block.

[1:40] I will multiply loudness with, let's say, four. You can play around with any numbers here.

```when gf clicked
forever
set y to ((loudness) * (4))
end
```

[1:52] Now when you make a sound, the cat will jump higher.

[2:01] Finally, can you make the cat move in a horizontal direction when you clap?