SCRATCH Lesson 4: Create a Music Sprite

In this lesson 3, we make our sprite dance. In lesson 4, I will show you how to make him dance to the beat. And not just to the beat but to the Hip-Pop beat! (Note: the video below used Scratch 1.4. For instruction with Scratch 2.0, please read the article)

(Note: Updated for Scratch 2.0 )

Step 1: Create a Music Sprite

Let’s create a Music Sprite or a sprite that controls playing and stopping of background music.

Click on the alien-looking icon  (choose sprite from library) to choose a costume from library.

Browse to select whatever costume you like. I chose the drum.

 

Rename this new sprite to “hip-pop”. It’s seems big for me so I shrink it with “Shrink Sprite” tool.

 

Then click anywhere outside of the stage to get back to the cursor.

Step 2: Move Music Loop to the Music Sprite

Drag the Music Combo Block from dancer1’s Scripts Tab.

Delete the combo block that plays music clips from “dancer1”.

 

Select “hip-pop” sprite, click on “Sound” tab, and click the speaker icon to import  “beat box1” from the music library

Step 3: Turn Music On and Off

To turn music on and off, we need to create a virtual switch. Like a real switch, a virtual switch can be on or off. To create a virtual switch, we use Variables. Select “Variables” Tool Box, and click “Make a variable” button. Then enter “switch” for Variable name.

 

I would like this switch to work this way:

When the animation first starts, the music is playing and the switch is on. Click the “dancer1” sprite to turn it OFF, and click the “hip-pop” sprite to turn it ON again. If the switch is ON, music is ON; if the switch is OFF, music is OFF.

For this switch to work, we need following blocks:

  • one  block from  tool kit

  • one  block from  tool kit

  • one  block from  tool kit

 

For  sprite, we will add three new combo blocks. The first combo block turns the switch ON (set music on to 1) when  is clicked.

 

The second combo block turns the switch ON again (set music on to 1) when “hip-pop” is clicked.

For  sprite, we will add one combo block. This combo block will turns the switch OFF if “dancer1” is clicked.

 

Your “dancer1” sprite should have these combo blocks.

 

Your “hip-pop” sprite should have these combo blocks.

Now you are ready to test. Click the green flag to start, click dancer sprite to stop the music, and the drum to start it again.

You can find the finish project here: http://scratch.mit.edu/projects/1616790/

13 Comments

  1. Laura

    I could not get this tutorial to work right. The drum stopped playing everytime I added the switch and other things.

    • admin

      Hey Laura,
      Could you give me the url to your scratch project on the scratch site? If so, i can take a quick look.

  2. Venky

    Hi Jessica
    I can’t seem to get Lesson 4 to work. I’ve checked it several times to ensure I am doing exactly like what you are, but the music just does not play as soon as I add the switch.
    Thanks.

    • Jessica Chiang

      Hi Venky

      This lesson was created based on Scratch 1.4. I tried it with Scratch 2.0 and you are absolutely right. It did not work anymore. I believe this is a bug or unfinished feature in Scratch 2.0. When dragging the code block that contains music clip from one sprite to another, the code is copied but not the music clips referenced. I will update the lesson to reflect changes in 2.0. Thanks for the headsup.

    • Jessica Chiang

      Hi Venky,

      I’ve updated this post for Scratch 2.0, and also have included the project link. Hope you will find it helpful.

      regards,
      jessica

    • Anonymous

      sorry mam

  3. Good day! This post couldn’t be written any better! Reading through this post reminds me of my previous room mate! He always kept talking about this. I will forward this write-up to him. Fairly certain he will have a good read. Thanks for sharing!

  4. Anonymous

    its not workingggg it is so hard

  5. pass da boof

    PASS DA BOOF

  6. Anonymous

    LISTEN HERE BOOMER I DO NOT UNDERSTAND THIS ONE LITTLE BIT PLEASE SEND ME 2,000 DOLARS FOR BRAIN SURGRY BECASE I HAVE LOST 256 BRAIN CELLS CAUSE OF YOU THANK YOU BOOMER

Comments are closed