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 Add Some Tunes

Transcript

Many games play music in the background to set the mood and make the game more entertaining.

Yours can, too! While you can program music to play for a specific sprite, it’s usually a good idea to program the music on the stage. To do this, click on the stage. The music should start when the green flag is clicked, and keep playing forever. Scratch comes with a lot of sounds that sound good when they’re played over and over. These types of sounds are called “music loops.”

To choose a music loop for your project, click on the sound tab, “add sound from library,” then the Music Loops Menu. Test sounds by pressing the play button, so you can find the sound that works best for your program.

You’ve now added a music loop to your program, but you still need to program it to play.

Click on sound, and find the “play sound” blocks.

Adding “play sound” to your block stack will tell the computer to move on to the next instruction in the stack after it starts to play a sound. That means your sound can be interrupted by other sounds, and won’t work well when repeated because it never finishes playing.

Instead, add a “play sound until done” block inside a forever loop. This now reads: You can now test it to make sure your code does what you want.

Great! The music loop is playing in the background forever.

Choose an Add-On
Time to Celebrate!
Create a wild winning celebration using some of these ideas.
Moving Platforms
Make your game more challenging by creating moving platforms.
Shrinking Platforms
Create a shrinking platform to increase your game's difficulty.
Splash! You Lose
Create a way for the player to lose in your game.
Add Some Tunes
Add some background music to your game.
Bug Fix: Land on Your Feet...or Not
Fix the bug that allows things other than a sprite's feet to keep it on a platform.
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!