Play it first
Here is the story you will make today.
The story
The cat hears a dog bark and runs back and forth, trying to get away from the dog. But the cat cannot even see the dog!
The cat hears a dog bark and runs! Use a sound block and a forever block to tell the story.
Here is the story you will make today.
The story
The cat hears a dog bark and runs back and forth, trying to get away from the dog. But the cat cannot even see the dog!
Press File, then New. Keep the cat. It is the star of this story! Watch the video. It shows you how to start, and it also shows Steps 2 and 3, so you can build along with it.
Build this script. Press the Green Flag to try it.
Move once
One move is not much fun. The cat needs to keep running! The forever block does the same thing again and again.
Keep running
The inside of forever is like a loop. Anything inside it happens again and again.
The cat runs because it hears a dog bark. First, give your cat a bark sound.
Use your headphones, or ask your teacher about sound. Click a sound in the library to hear it first.
In a story, the bark comes first, and then the cat runs. Put the sound block above forever.
The cat hears a dog and runs
The sound block must go above forever. Forever never finishes, so a block under it would never get a turn.
Change the number in the move block. Try 3, then 20. Is the cat more scared with a bigger number?
Click the number, type a new one, then press the Green Flag.
Sometimes the cat flips over when it bounces. You can fix it.
The stage is a grid. Every spot has two numbers: x for left and right, and y for up and down. The very middle is x 0, y 0. Let us make a key that sends the cat there.
Press H to go to the middle
You can use this in every project. Press h, and your sprite is back in the middle, ready to try again.
Play the finished project at the top of this page again. Is your story the same?
Make the story even better.
Great work! Pick what comes next.
Sequence Order matters. The bark must come before forever, because a forever loop never ends and nothing under it would ever run. Children discover this by trying it, and often by dragging the block to the wrong place first.
Loops Forever is a loop. Children learn that a computer repeats instructions cheaply, so we can say it once.
Experimenting Changing the number and watching the result is testing and iterating, the heart of the Brennan and Resnick practices.
Coordinates The stage is a grid with the middle at x 0, y 0. Scratch shows a sprite's x and y in the sprite info box and fills them into the go to block, so children do not have to work out numbers. Knowing where things are on the grid is how they will place every character in the game.
Story as a plan The story tells children what the program must do: bark, then run. Matching blocks to a story line by line is decomposition.
Grown-ups: how did this activity go? Send us feedback
Plan about 30 to 40 minutes. Watch the video together, then let children build. Children need sound for this lab: headphones work well. The H key step teaches coordinates, so give it a minute to sink in. Check the notes for teachers and parents for account options.