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 Pump the Jams

Transcript

In this add-on, you will 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 and the show block.

Click the costumes tab to see the three costumes in the music sprite.

This example will use 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 will find many different sounds there that you can use in your program.

There are different categories of sounds.

Click on the "Music Loops" category on the left to see different music loops, or short sections of music tracks.

These loops are longer than other sounds.

Press the "play" button on each sound to hear it.

When you find a song you like, click on it, then click "OK."

You can now add the new song to your project.

To do that, click on the scripts tab, 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 this 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.

Choose an Add-On
play_circle_filled
+1 Button
Program a "plus 1" button so users can express that they liked your page.
arrow_forward
play_circle_filled
Post a Shoutout
Code your program so that users can give a shoutout or share a post.
arrow_forward
play_circle_filled
Pump the Jams
Add music to your profile page.
arrow_forward
play_circle_filled
Change Profile Picture
Code your profile android to change its look
arrow_forward
play_circle_filled
Ping
Program your friend's sprites to respond to your favorite stuff!
arrow_forward
play_circle_filled
Hidden Feature
Code a surprising action on your profile page!
arrow_forward
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!