Play it first
Here is the story you will make today.
The story
The dog wants to go out and wander around to see what he can see. He wants you to guide him so he does not get lost!
Add a dog, then use the arrow keys to guide the dog up, down, left and right.
Here is the story you will make today.
The story
The dog wants to go out and wander around to see what he can see. He wants you to guide him so he does not get lost!
Press File, then New. The cat is there, but this story is about a dog. Watch the video. It shows you how to start, how to add the dog, and how to take the cat away in the next step.
The cat does not belong in this story. Take it off the stage.
Scripts go to the sprite you picked. Always click the dog before you build. If you delete the wrong sprite, open the Edit menu and choose Restore Sprite.
Build this script for the dog. Press the right arrow key on your keyboard.
Dog goes right
x is how far left or right. y is how far up or down. Change x moves the sprite sideways.
Copy the idea three more times. Change the key and the number.
Dog goes left
Dog goes up
Dog goes down
A plain number goes one way. A number with a minus sign goes the other way.
Right now the dog slides backward when you press the left arrow. Let us turn him to face where he is going.
Dog goes right and faces right
Dog goes left and faces left

You do not need to know the numbers. Just drag the arrow in the dial to point the way you want the dog to go. The up and down scripts stay the same.
Press each arrow key. Does the dog go the right way? Guide him all around the stage, and do not let him get lost!
If something does not work, do not worry! Finding and fixing a problem is called debugging. Every coder does it.
Remember the H key from Lab 2? Add it to your dog. Then you can always send him back to the middle, x 0 and y 0.
Press H to go to the middle
Play the finished project at the top of this page again. Does your dog move the same way?
Great work! Pick what comes next.
Events An event starts a script. Children see that the computer waits for them.
Decomposition The big idea "move in four directions" splits into four tiny scripts.
Pattern recognition The four scripts are nearly the same. Duplicating and changing one thing uses the pattern.
Sprites keep their own scripts Each sprite has its own code. Scripts built for the cat stay with the cat, so the dog needs its own. This idea comes back in the game.
Negative numbers without the math Point in direction uses 90 for right and -90 for left. Scratch's round dial lets children pick a direction by dragging an arrow, so they do not need to understand negative numbers yet. It also matches change x by -10 for moving left. Using point in direction, instead of turn blocks, means the sprite always faces the way it moves.
Debugging Testing each key and fixing it is the testing and debugging practice.
Grown-ups: how did this activity go? Send us feedback
Plan about 30 to 40 minutes. Watch the video together, then let children build. The step that adds a dog and removes the cat is new for many children, so check that each child has clicked the dog before building scripts. Check the notes for teachers and parents for account options.