In this Add-On, you'll program music
that will play when the flag is clicked.
Many profile pages are customized with music.
It allows people to share their favorite songs
or music that they like.
To start, click the music sprite,
then click the Looks menu, then the show block.
Click the Costumes tab
to see the three costumes in the music sprite.
This example used the drum costume,
but you can use any costume you'd like.
You can move the music sprite
to a different spot on the stage.
Next, click on the Sounds tab on your project,
then on choose new sound from library.
You'll find many different sounds there
that you can use in your program.
There are different categories of sounds.
Click on the music loops category
to see different music loops
or short sections of music tracks.
These loops are longer than other sounds.
(upbeat techno music)
When you find a song you like,
click on it.
You can now add the new song to your project.
To do that, click on the Sound menu
and drag a play sound until done block
into the script editor.
The play sound block plays a specific sound
without pausing the rest of the code.
This block is mostly used for quick sound effects.
The play sound until done block, on the other hand,
pauses the rest of the code
until the sound has finished playing.
For this example, using a play sound until done block
will prevent your music from being cut short.
To make this code start when a user clicks the flag,
add a when flag clicked event to the top of your code stack.
Click the flag to test your code.
Great, the music plays.
Now it's your turn.
Show the music sprite and select a costume.
Add a play sound until done block
under a when flag clicked event,
so the music will play when the flag is clicked.
As an added challenge, make your music play forever
using a forever loop from the control menu,
and code your music to play when the sprite is clicked
instead of when the flag is clicked.
Program a "plus 1" button so users can express that they liked your page.
Add music to your profile page.
Code your profile android to change its look
Program your friend's sprites to respond to your favorite stuff!
Code a surprising action on your profile page!
Sign in to track your progress and earn badges