Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

Transcript

In this add-on, you'll program a sprite to play sound and cheer when it is clicked.

You'll also program other sprites to react positively or negatively when that sprite is selected.

To get started, select the sprite that you want to cheer when it is clicked.

Next, select the sound tab and click choose sound from library.

Once, you've find the sound that you liked, click on it.

(pop)

To make the music play in your project, you need to add blocks that tell the program when to play this sound.

Click on the scripts tab, then open the sounds menu.

Drag out the sound block and snap it to the bottom of the when this sprite is clicked code stack.

Now, each time the sprite is clicked, its vote counter will increase by one and it will make the sound you picked.

To make the sprite cheer when it is clicked, add a say block to the bottom of the code stack.

Change the message in the space on the say block to say something cheerful.

In this example, the sprite says "Yay!" when clicked.

To make sprites respond when another sprite is picked, the sprite that was chosen, must say a message that it was picked.

To do this, select the events menu and drag out a broadcast block.

Click on the drop down menu then select new message.

Name the message something that makes sense to you.

In this example, the message is called react.

Place the broadcast block under the when this sprite is clicked block.

Now, when the sprite is clicked, it will send out the message, react to any other sprite that is waiting to hear that message.

Next, you need to program the other sprites to receive that broadcasted message.

Click on a different sprite, drag out the when I receive block, make sure the message react or the message name you chose, is selected in the drop down menu.

Now, when the sprite receives the react message, the sprite will run any code below the block.

Add a say block under the when I receive block.

Make the sprite say something in the reaction to another sprite being picked.

Sprite might get jealous and say something like "Boo!"

or the sprite might be encouraging and say something like "good for you" to make the other two sprites also react, drag the when I receive code stack to each of them.

This will copy the code from one sprite to another.

Feel free to modify the text in the say block for each sprite to make each react differently.

Now it's your turn.

Choose a sound from the sound library.

Add a play sound block to the when this sprite is clicked code stack.

Add a say block.

Add a broadcast block and change the message to something that makes sense.

For the other sprites, and a when I receive block and select the title of your message in the drop down.

Add a say block and modify the text to say the sprite's reactions.

Choose an Add-On
Spinning Celebration
Program a sprite to spin and change color when a user clicks on it.
Shout it Out
Program the sprites to react when a particular sprite is selected.
Shrinking Sprite
Make one of the sprites shrink if the mouse touches it.
Secret Votes (Challenge)
Make the vote count for each sprite secret.
Pick Me (Challenge)
Make a sprite demand to be picked whenever the mouse-pointer touches it.
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!