For the Multiple Musicians badge,create two or more sprites that performtwo different simultaneous actionswhen you mouse over them.
In this example, when the mouse touches each Picoit plays a note and then changes colors.
Just like in many of the other badges for today,since the sprite needs to do two thingswhen 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 blockfrom 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 noteand changes colors when the mouse touches him.
One code stack plays the noteand the other change its color.
Do you wonder what would happenif you put both the Change Color and Play Note blocksinside of a single stack, instead of two?
Let's take a look.
These three Picos have the code in two stacksso they change color and play the noteas quickly as they can when the mouse touches them.
The last Pico has only one stackwith both blocks inside of him.
When the mouse pointer touches the Pico with one block stackit changes the color and then plays a note.
Then it changes to a new colorand next plays another note forever.
It can do both actions at the same timebecause the blocks are stacked on top of one anotherrequiring the sprite to complete one actionbefore moving onto the next.
Having two code stacks that each do one actionsolves that problem because one set of code does not needto finish running before the other begins.
This is an important computer science conceptcalled Parallel Processing, which means that a computercan handle many code instructionsfrom a computer scientist at the same time,but only when the computer scientist instructsthe computer to run the instructions simultaneouslyinstead of one instruction after the other.
As always, the control is all in your handsbecause 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 separateblock stacks that can control the actionsyour 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 spriteby righting click on it and choosing duplicate.
In the second set of code, change the actionsso that your sprite does something totally different.
You can make your sprite do whatever you wantbut here are some ideas to get started.
You can have each sprite make a sound and say something.
Or you can have each sprite make a drum noise and spin.
Now it's your turn.
Choose a sprite, then build two block stacksthat start when the flag is clicked.
Contain a Forever Loop and use a If Then loopto check if the mouse it touching the sprite,then make it perform an action.
Create at least one copy of your spriteso the user can interact with more than one character.
When you're done, earn the Multiple Musicians badge.