In this video, you'll make the sprite
dance in one spot on the screen.
Watch first, as the video shows you the steps
that you'll need to take.
Then comes the fun part,
where you get to try it for yourself.
Some sprites in Scratch like Cassie, have multiple costumes,
so just the one shown here on the costumes tag.
A costume's one of the many possible
appearances of a sprite.
If you click on each of the sprite's costumes,
her appearance changes so that it looks like
she is dancing.
You can also change the sprite's costumes with code,
choosing the looks menu.
There, you will find many blocks that affect the sprite's
appearance, click any button to see what it does
or you can drag a block into the script editor
to include it in your project.
If you drag the next costume block into the script editor,
and click the code block,
the sprite costume changes, and she dances.
What, you want the sprite to keep dancing,
and your hand will get pretty tired, if you keep
having to click the next costume block.
This is a great time to use the Forever block.
Click on the control menu and choose the forever block.
Drag the forever block into the Script Editor
and place it around the next costume block.
Now, click the blocks that can test your code,
and see what happens.
Cassie dances really fast, and she keeps on dancing.
Computers are great at following instructions,
quickly, and repeating them forever.
One of the best reasons to know
a little Computer Science is that you can use it
to make repeated tasks happen automatically.
This is certainly a lot easier than clicking
the next costume over and over again.
To change how fast the sprite dances,
use a wait block, which you will find also
under the Control menu.
Place the wait block inside the forever loop
to create a pause before the next costume change.
If the sprite is moving too slowly,
tinker with the value in the wait block
to change the speed of the costume change
until you find one that works.
For example, adding a wait one-second block
into the forever loop makes the sprite wait one second
between costume changes.
If that seems a little slow, try changing the wait block
or wait value, to .1.
Too fast, maybe .2.
All right, that's better.
When you do this on your own, try a few different values
in the wait block, and pick the one you like best.
If you get stuck, ask your neighbor or teacher
to help you find a solution.
Now it's your turn.
Use the next costume block in a wait block with any value
inside of it that you like the most.
Remember to put a forever block around those blocks,
so that they run over and over again, forever,
when you click on them.
When you finish this step, return to this CS First page
and click the green arrow to move on to the next video.
Sign in to track your progress and earn badges