Scratch lesson 2 of 10 · Beginner · About 25 minutes
Give a dancer two poses and a side step. Use a repeat loop and timed pauses to turn one move into a routine.
What you’ll make Make a dancer repeat the same two-pose routine four times and finish at their original position.
Get ready
Open the Scratch editor (opens in a new tab) and start a new project.
- Start a fresh Scratch project and name it Two-Step Dance. Keep the default sprite if it has two costumes or choose any sprite with two visibly different poses.
- Rename the sprite Dancer. Open Costumes and check that it has exactly two costumes. If there is only one, right-click its thumbnail, choose duplicate, and use the paint tools to make the copy look different. If you already have two, leave the artwork as it is.
- Rename the first costume Pose A and the second Pose B in the name field above the costume canvas. Use a sprite with just two costumes so next costume can switch back and forth.
To keep your project, choose File → Save to your computer in Scratch.

Build it in Scratch
Choose the sprite named above each stack. The colours help you find the block categories. Indented rows sit inside the block above. Follow the end marker to see where each loop or condition closes.
1. Set the opening pose
Go back to Code with Dancer selected. Under the green-flag event, set the starting position to 0, -35. In Looks, select switch costume to [] and use its menu to choose Pose A. Add a short wait from Control. The centred x position leaves room on both sides, and the pause makes the opening pose visible.
when green flag clickedgo to x: (0) y: (-35)switch costume to [Pose A]wait (0.4) seconds2. Make one full two-step
Extend the same stack. Choose next costume in Looks. Then use Motion to change x by 15, which steps to the right, and Control to wait 0.3 seconds. Add the three blocks again with x changed by -15 this time. Dancer should go right in Pose B and return to the start in Pose A. The diagram shows just the six new blocks. Click the green flag after attaching them.
next costumechange x by (15)wait (0.3) secondsnext costumechange x by (-15)wait (0.3) seconds3. Repeat the move four times
Drag a repeat () block from Control. Pull the six dance blocks off the bottom of the opening stack together and snap them inside the repeat block. Attach the repeat block immediately below the opening wait. Set repeat to 4. Scratch runs all six blocks inside once, then goes back to the top of the loop. Read the indent in the diagram as ‘inside repeat’. Its closing line marks the end of the loop, so there is no extra block to find.
when green flag clickedgo to x: (0) y: (-35)switch costume to [Pose A]wait (0.4) secondsrepeat (4)next costumechange x by (15)wait (0.3) secondsnext costumechange x by (-15)wait (0.3) seconds4. Add an optional beat
Open Sounds and add any short tap or clap. Rename the sound Beat in the sound name field. Return to Code, open Sound and put start sound [Beat] between the right step and its wait, inside the loop. Use the sound menu to select the sound you added. This block starts the sound and goes straight to the next block, so the wait still controls the length of the pose.
change x by (15)start sound [Beat]wait (0.3) secondsTest your project
- Count the steps to the right out loud. There should be four, each followed by a step left.
- Check Dancer finishes where they started in Pose A. With four repeats of +15 and -15, each outward step is matched by a return.
- Drag Dancer away from the centre and switch to Pose B. Click the flag. The starting blocks should put Dancer back at x 0, y -35 in Pose A before the first step.
If something goes wrong
- The dancer drifts across the stage.
- Confirm that both x changes are inside repeat. Check they are 15 and -15, with opposite signs.
- The dancer seems to stay in one pose.
- Check that your costumes look different and that both waits are inside repeat. Try changing each wait to 0.6 seconds to make the alternation easier to see.
Make it your own
- Try a faster routine by changing both loop waits to 0.2 seconds. Predict what will stay the same before you run it.
- Make the dancer take wider steps by using 30 and -30. Explain why the dancer still finishes at x 0.
What you’ve learned A loop repeats the instructions inside it. Costumes change the sprite's appearance, and waits give viewers time to see each pose.