Please update your browser
Your browser version is not supported by this site. CS First may not work properly.
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.
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.