(man) In this video, you will learn how to program
a scary sprite, that you and you friend
will run away from during the game.
If either you or your friend touches this sprite,
it will subtract points from your score.
First, choose a sprite to be the scary object.
There are few ways to add a new sprite to your project.
You can choose one from Scratch's library, paint one,
or copy an existing sprite and edit it.
To copy an existing sprite, right click on it
and select duplicate.
Then edit the sprite in the paint editor.
Check out the designer add on for more information
about how to edit sprites.
This example will use a bat from Scratch's library.
The programming for this sprite
is a lot like the programming for the bonus sprite.
So you can use the same code to save time.
Click on the bonus sprite.
Drag the code from the bonus sprite over
to the new sprite in the sprites area.
This sprite will score differently
from the bonus sprite however.
So remove the if statement that contains the scoring code.
From the control menu, drag out a new if then block.
To win points with the bonus sprite,
both you and your friend had to touch it.
This new sprite will subtract points
if either you or your friend touches it.
From the operator's menu, place an or block
in the if then block.
From the sensing menu, drag out two touching blocks
and place them on each side of the or block.
From the dropdown, select blue android on one menu,
and yellow android on the other.
Next, program what will happen if the danger sprite
is touching either the blue or the yellow android.
The score will go down.
From the variable menu, drag out the change score by block
and place it inside the if then block.
Place the number that will get subtracted
from the score in the box.
This example uses negative five.
Just like with the stars, this sprite should disappear
after either the blue or yellow android touches it.
From the control menu, place the delete this clone block
after the change score by block.
Finally, place the if statement inside the forever loop
that makes the sprite fall.
Test the code by clicking the green flag
and playing the game.
Try catching the danger sprite with the blue android.
The score should decrease.
Try catching the next one with the yellow android.
The score should go down again.
Try catching it with both at once.
The score decreases. Great!
Now it's your turn!
Add a new danger sprite.
Copy the code from the bonus sprite,
then delete the scoring code.
Make the sprite score using if or touching
and change score by blocks.
Finally, put this new block inside the falling forever loop.
Add a winning condition to your game.
Add a sprite that causes you to lose points if you or your friend touches it.
Learn how to design the sprites.
Add sound to your project.
Make the sprites react when they touch each other.
Sign in to save your project and track your progress.