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

For the Multiple Musicians badge, create two or more sprites that perform two different simultaneous actions when you mouse over them.

In this example, when the mouse touches each Pico it plays a note and then changes colors.

Just like in many of the other badges for today, since the sprite needs to do two things when you mouse over it, you need two events to start the code.

You use two When Flag Clicked blocks.

For each block, add a Forever Loop, and an If Then block.

Use a Touching The Mouse Pointer block from the Sensing menu.

Now you can read this block stack.

It should say, when the flag is clicked, forever check if the mouse-pointer's touching that sprite.

If the mouse-pointer is touching the sprite, then do something else.

It's up to you to decide what you want each Pico to do.

In this example, Pico both plays a note and changes colors when the mouse touches him.

One code stack plays the note and the other change its color.

Do you wonder what would happen if you put both the Change Color and Play Note blocks inside of a single stack, instead of two?

Let's take a look.

These three Picos have the code in two stacks so they change color and play the note as quickly as they can when the mouse touches them.

The last Pico has only one stack with both blocks inside of him.

When the mouse pointer touches the Pico with one block stack it changes the color and then plays a note.

Then it changes to a new color and next plays another note forever.

It can do both actions at the same time because the blocks are stacked on top of one another requiring the sprite to complete one action before moving onto the next.

Having two code stacks that each do one action solves that problem because one set of code does not need to finish running before the other begins.

This is an important computer science concept called Parallel Processing, which means that a computer can handle many code instructions from a computer scientist at the same time, but only when the computer scientist instructs the computer to run the instructions simultaneously instead of one instruction after the other.

As always, the control is all in your hands because the computer will only do what you, the computer scientist, tell it to.

There is no right or wrong answer.

If you're happy with the result of your code, then you found the right answer for your program.

To earn this badge, you should have two separate block stacks that can control the actions your sprite would take when the mouse touches it.

Once you have decided what those actions are, try a code that makes sure it does what you want.

(musical notes playing)

Then make at least one copy of your sprite by righting click on it and choosing duplicate.

In the second set of code, change the actions so that your sprite does something totally different.

You can make your sprite do whatever you want but here are some ideas to get started.

You can have each sprite make a sound and say something.

(chirping) Ya!

Or you can have each sprite make a drum noise and spin.

(drumming) (ringing)

Now it's your turn.

Choose a sprite, then build two block stacks that start when the flag is clicked.

Contain a Forever Loop and use a If Then loop to check if the mouse it touching the sprite, then make it perform an action.

Create at least one copy of your sprite so the user can interact with more than one character.

When you're done, earn the Multiple Musicians badge.

Choose an Add-On
Bust a Move
Learn how to earn the "Bust a Move" badge.
Energy Burst
Learn how to earn the "Energy Burst" badge.
Multiple Musicians
Learn how to earn the "Multiple Musicians" badge.
Clone Crazy
Learn how to earn the "Clone Crazy" badge.
Vote on the Talent Show (Advanced)
Modify your project so you can vote for a talent show contestant.
Win the Show! (Advanced)
Make the winning performer celebrate their victory!
arrow_backward Back
Next arrow_forward
Instructions
  1. See the talent show characters you can build.
  2. Find out what badges you can earn.