This isn't a game for just you.
This video will show you how to add an object
for your friend to catch, as well as a special bonus object
that you and your friend will catch together.
The yellow star works a lot like the blue star,
so you can just copy the code.
Drag the code from the blue star
to the yellow star in the Sprite's area.
That saved a lot of time and effort
because now you just need to change a few things,
rather than creating a new stack of code.
When the yellow star touches the blue Android,
the score should go down, so change that value
to negative one.
When the yellow star touches the yellow Android,
the score should go up, so make that value positive one.
Click the green flag to test the code.
If you catch the yellow star with the blue Android,
then the score will go down.
If you catch the yellow star with the yellow Android,
then the score will go up.
Finally, program the object that both you and your friend
need to catch at the same time, the green star.
This object will make clones and fall just like the others,
so drag the code from the yellow star to the green star.
This Sprite's scoring will differ from
the scoring for the other stars.
Remove the two if statements that involve scoring.
The green star will score if both the Androids touch it.
Scratch offers a block for that.
From the control menu, drag out a new if block.
From the operator's menu, select an and block
and place it inside the if block.
From the sensing menu, drag out two touching blocks
and place them on each side of the and block.
Click the dropdown to check that it says blue Android
on one side and yellow Android on the other.
Finally, program what should happen
when the object touches both Sprites.
The score should change.
This object is harder to catch than the others,
since it requires you and your friend to work together,
so it should probably increase the score
more than the other objects.
This example uses five, but you can use
whatever value you like for your game.
Place the if statement inside the forever loop
to make the clone run it.
Finally, delete the green star clone after it scores.
From the control menu, drag out the delete this clone block
and place it under the change score by block.
Test the code.
If only the yellow Android touches the green star,
If only the blue Android touches the green star,
If both the blue and yellow Android touch the green star,
the score goes up.
Feel free to tinker with the values.
For example, maybe the green star
should wait longer than the other two stars before falling.
That will complete your project.
If you need help, ask a neighbor.
Make your CS First experience more social and fun
by sharing what you created today
with the Scratch community.
Before you go, hit the share button
and write a description of your project
so others on Scratch can enjoy it.
Now it's your turn.
Program the yellow star to work similarly
to the blue star by copying the blue star's code
and changing the necessary values.
Copy the code from the blue star
to make the green star fall.
Check if both Androids are touching the green star
using if, and, and touching Sprite blocks.
Finally, make the green star react to touching
both Androids by changing the score and deleting the clone.
Sign in to save your project and track your progress.