Second Grade · Getting Started with Scratch Coding

Lab 2: Make It Move

The cat hears a dog bark and runs! Use a sound block and a forever block to tell the story.

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!

Play: The cat hears a dog

This project plays from the Scratch website. Nothing loads from Scratch until you press play.

Turn your sound on. Press the Green Flag above the stage. Press the red Stop button when you are done.

  1. Step 1: Start a new project

    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.

    Video coming soonStart a project and make the cat run (Steps 1 to 3)
  2. Step 2: Make it move on a flag

    Build this script. Press the Green Flag to try it.

    Move once

    when green flag clicked
    move 10 steps
  3. Step 3: Run over and over

    One move is not much fun. The cat needs to keep running! The forever block does the same thing again and again.

    Keep running

    when green flag clicked
    forever
    move 10 steps
    if on edge, bounce
    1. Click Control. Drag forever under the flag block.
    2. Drag move 10 steps inside the forever block.
    3. Click Motion. Drag if on edge, bounce inside, under move.
    4. Press the Green Flag. Press the red Stop button to stop.

    The inside of forever is like a loop. Anything inside it happens again and again.

  4. Step 4: Let the cat hear the dog

    The cat runs because it hears a dog bark. First, give your cat a bark sound.

    Video coming soonAdd a dog bark and play it first
    1. Click the cat in the Sprite list.
    2. Click the Sounds tab at the top left.
    3. Move your mouse over the Choose a Sound button at the bottom left. Click it.
    4. Look for a dog sound, such as Dog1. Click it, then click the Code tab to come back.

    Use your headphones, or ask your teacher about sound. Click a sound in the library to hear it first.

  5. Step 5: Play the bark before the run

    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

    when green flag clicked
    play sound Dog1 until done
    forever
    move 10 steps
    if on edge, bounce
    1. Click Sound. Find play sound until done.
    2. Drag it between the flag block and the forever block. The other blocks will slide down to make room.
    3. Click the little menu on the sound block and choose your dog sound.
    4. Press the Green Flag. Do you hear the bark, and then see the cat run?

    The sound block must go above forever. Forever never finishes, so a block under it would never get a turn.

  6. Step 6: Make it faster or slower

    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.

  7. Step 7: Fix the upside-down cat

    Sometimes the cat flips over when it bounces. You can fix it.

    1. Click your sprite in the Sprite list.
    2. Click the word Direction in the sprite info box, then choose the left-and-right arrows.
  8. Step 8: Send it to the middle with the H key

    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.

    Video coming soonScratch coordinates: go to the middle (0, 0)
    1. Click your cat. Find the x and y boxes in the sprite info box.
    2. Drag the cat around the stage. Watch the x and y numbers change.
    3. Click Events. Drag when space key pressed into the Script area. Click space and choose h.
    4. Click Motion. Drag go to x: y: under it. Type 0 in the x box and 0 in the y box.
    5. Press the Green Flag. Press the h key on your keyboard. The cat jumps to the middle!

    Press H to go to the middle

    when h key pressed
    go to x: 0 y: 0

    You can use this in every project. Press h, and your sprite is back in the middle, ready to try again.

Check your work

Play the finished project at the top of this page again. Is your story the same?

  1. Do you hear the dog bark first?
  2. Does the cat run back and forth after the bark?
  3. Does the cat turn around when it reaches the edge?
  4. Does the cat jump to the middle when you press h?

Want to try more?

Make the story even better.

  • Make the cat say Uh oh! for 2 seconds before the bark. Where does the Looks block go?
  • Try a different animal sound. Does the story change?

Finished?

Great work! Pick what comes next.

For grown-ups: computational thinking in this lab

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

For teachers

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.

Read the full notes for teachers and parents