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 changes color. Just like in many of the other badges for today, since the sprite needs to do TWO things when you mouse over it, you'll need TWO events to start the code. You'll use two “when flag clicked” blocks.

For each block, add a “forever” loop and an "if-then block." Use a "touching mouse-pointer" block from the sensing menu. Now, you can read this block stack. It says: "When the flag is clicked, forever check if the mouse pointer is touching the sprite." If the mouse pointer IS touching the sprite, then.... do something. It’s up to you to decide what YOU want Pico to do. In this example, Pico both plays a note and changes color when the mouse touches him. One code stack plays the note, and the other changes the color. Do you wonder what would happen if you put both the change color and play note blocks in a single stack instead of in two? Take a look. These 3 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 code stack with both blocks inside it. When the mouse touches the pico with one block stack, it first changes color, then it plays a note. Then, it changes to a new color and, next, plays another note forever.

It can't do both actions at the same time because the blocks are stacked one on top of another, requiring the sprite to complete one action before moving on to 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’s no “right” or “wrong” answer--if you are happy with the result of your code, then you've found the right answer for your program. To earn this badge, you should have two separate block stacks that control the actions your sprite will take when the mouse touches it.

Once you decide what those actions are, try your code to make sure it does what you want, then make at least one copy of your sprite by right-clicking on it and choosing duplicate.

In the second set of code, change the action so the sprite does something different.

You can make your sprites do whatever you want, but here are some ideas to get you started: You can have each sprite make a sound and say something. Or, you could have each sprite make a drum noise and spin. 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 an “if-then” loop to check if the mouse is 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, put up your sticky and show your sprites to your Gurus so you can 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.
Music Promoter
Learn how to earn the "Music Promoter" 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.