arrow_back Adding Sound
In this add-on, you’ll add some cool video game sounds and background music to your project.
Start by clicking on the “sounds” tab. The android sprite from the starter project comes with a bunch of sounds. Select one, then click the “play” button to hear what it sounds like.
Some sounds are short, so they are especially good for sound effects..
Longer sounds make great background music. To add sound effects to your project, click the “scripts” tab. Then, open the “sounds” menu, and drag out a “play sound until done” block.
Click the dropdown menu in this block, and choose the name of a sound to add.
Click the block to test it out. Cool! The sound plays.
Add this block to the main code stack in the spot where the sound should play in your program.
This example places the block at the very beginning, right after the “when flag clicked” block. Click the flag to test it out. Great! The sound plays, then the android starts talking. Add “play sound until done” blocks to the different places in your code where you’d like a sound effect to happen..
To add background music that plays while the android talks, drag out a “play sound until done” block, and select a sound. Then, place a “forever” block from the “control” menu around this block. Add a “when flag clicked” block on top.
The two block stacks that start with the same “when flag clicked” event will run at the same time. Click the flag to test it out. Awesome! The project plays some sweet background music. Now, it’s your turn!
Add sound effects to your project using a “play sound until done” block.
Add background music using the “play sound until done,” “forever,” and “when flag clicked” blocks.