Byte by Byte › Book 4: Office Apps and First Programs › Chapter 7: Motion, Coordinates and Sequences
Chapter 7: Motion, Coordinates and Sequences
You will learn: the Scratch stage as a coordinate grid (x and y, including negative numbers), directions in degrees, motion blocks such as go to, glide and point in direction, using waits for timing, and planning a precise sequence.
🌟 The Adventure
The opening act of the festival show was to be a puppet dance in honour of the Queen: the dancer puppet would enter from the left, glide to centre stage, turn to face the audience, bow and spin.
Memoon tried. She used move 10 steps again and again. The puppet stumbled forward in tiny jerks, overshot the centre, walked straight off the right edge of the stage and vanished. When she clicked the green flag again, it started from wherever it had ended up, half hidden behind the curtain.
"Where is the middle, exactly?" asked Kachui. "And how do we tell it to start in the same place every time?"
Memoon thought about her Bharatanatyam teacher, who always told each dancer exactly where to stand on the stage floor, marked with chalk. "We need a map of the stage," she said. "With numbers."

💡 Learn With Memoon
The stage is a coordinate grid. Every point on the Scratch stage has an address made of two numbers, called coordinates.
- x tells how far left or right. It runs from -240 at the left edge to 240 at the right edge.
- y tells how far up or down. It runs from -180 at the bottom to 180 at the top.
- The centre is (0, 0), called the origin.
So the stage is 480 steps wide and 360 steps tall. We always write x first, then y: (x, y). A handy reminder: you walk along the corridor (x) before you go up the stairs (y).
| Position | Coordinates |
|---|---|
| Centre | (0, 0) |
| Middle of the right edge | (240, 0) |
| Middle of the left edge | (-240, 0) |
| Top centre | (0, 180) |
| Bottom-left corner | (-240, -180) |
| Top-right corner | (240, 180) |
Negative numbers are numbers less than zero. On the x axis they are to the left of the centre; on the y axis they are below the centre. -100 is further left than -50. You can see the mouse's coordinates by moving it over the stage: they appear below the stage (in the online editor) and in a sprite's information in the sprite pane.
Directions are angles. Scratch measures direction in degrees, like a compass:
| Direction | Sprite faces |
|---|---|
| 90 | Right (the default) |
| 0 | Up |
| -90 | Left |
| 180 | Down |
A full turn is 360 degrees; a quarter turn (a right angle) is 90 degrees; a half turn is 180 degrees. turn ↻ 90 degrees turns clockwise a quarter turn; turn ↺ 90 degrees turns anticlockwise.
Motion blocks.
| Block | What it does |
|---|---|
| move (10) steps | Moves in the direction the sprite is facing |
| turn ↻ (15) degrees / turn ↺ (15) degrees | Rotates clockwise / anticlockwise |
| go to x: () y: () | Jumps instantly to a position |
| glide (1) secs to x: () y: () | Slides smoothly to a position over a time |
| point in direction (90) | Faces a direction |
| change x by (10) / change y by (10) | Moves right (or left if negative) / up (or down if negative) |
| set x to () / set y to () | Sets one coordinate only |
| if on edge, bounce | Turns round when touching the stage edge |
| set rotation style | All around, left-right only, or don't rotate |
Always set a starting position. A program should put sprites where they belong at the start, called initialising. Begin with go to x: () y: () and point in direction (90) right after the green flag. Otherwise each run starts from wherever the last run ended. Tip: drag a sprite to where you want it, and Scratch fills in its current x and y in the go to and glide blocks in the palette.
Timing. Computers run blocks extremely fast. If a sprite does three things with no pause, you may only see the last one. wait (1) seconds (Control) slows things down so people can see each step. Glide and say for (2) seconds have timing built in.
Planning a sequence. Before coding, plan in plain words (this kind of plan is called pseudocode) or on a sketch of the grid. For the dancer: start at (-200, -100); glide to (0, -100) in 2 seconds; face the audience; say Namaste!; turn 360 degrees in steps.

✍️ Try It Yourself
Activity 1: Explore the grid. Move your mouse slowly around the stage and watch the x and y numbers change. Find each corner. Find (0, 0). Find (100, -50). Which way did you move to get a negative y?
Activity 2: The Queen's dance. Choose a dancer sprite (for example, Ballerina or Dani) and the Theater backdrop. Build this script:
when green flag clicked go to x: -200 y: -100 point in direction 90 glide 2 secs to x: 0 y: -100 say Namaste! for 2 seconds turn ↻ 90 degrees wait 0.5 seconds turn ↻ 90 degrees wait 0.5 seconds turn ↻ 90 degrees wait 0.5 seconds turn ↻ 90 degrees glide 2 secs to x: 200 y: -100
Click the green flag several times. Does it always start in the same place? How many degrees did it turn altogether? Now remove the go to block and run it twice. What goes wrong?
Activity 3: Draw a square path. Use only move and turn blocks to make a sprite walk around a square and return to where it started. (Hint: four sides, four turns of how many degrees?) Add wait 0.5 seconds after each move so you can see it.
Activity 4: Treasure map. Place a Star sprite at (150, 120). Program a second sprite to glide there in three steps: first change x only, then change y only, then say Found it!
Unplugged: Grid dance. Draw a 5 × 5 grid on paper with x and y from -2 to 2. Give a partner coordinates such as (2, 1), (-1, -2), (0, 0) and have them place a coin on each. Then swap.
🎉 Memoon Solves It
Memoon drew the stage as a grid in her notebook, marked centre stage at (0, -100) where the floor was, and wrote her plan in pseudocode before touching a block. Then she built the script: go to the starting mark, point in direction 90, glide to centre, say Namaste!, four quarter turns with short waits, and a graceful glide off to the right.
She clicked the green flag. The dancer entered smoothly, stopped exactly at centre, bowed with a Namaste and spun once. She clicked it again. Exactly the same. And again. Perfect every time.
"Like chalk marks on the dance floor," said Memoon. Kachui nodded. "But four turns written out four times," he said, peering at the code. "Isn't there a shorter way?"
❓ Check Your Knowledge
- What are the x and y coordinates of the centre of the stage? What is that point called?
- What range of numbers can x have? What range can y have?
- Is (-150, 60) on the left or right half of the stage? The top or bottom half?
- Which direction number makes a sprite face up? Left?
- How many degrees are in a full turn? A quarter turn?
- What is the difference between go to x: y: and glide to x: y:?
- Why should a program set a sprite's starting position after the green flag?
- Why might you add wait blocks to a sequence?
- A sprite at (0, 0) runs change x by -50 then change y by 30. Where does it end up?
- Challenge: Plan a sequence that makes a sprite walk around a rectangle 200 steps wide and 100 steps tall.
📚 Word Bank
- Coordinates: a pair of numbers (x, y) giving a position on a grid.
- x / y: the horizontal (left-right) / vertical (up-down) coordinate.
- Origin: the centre point (0, 0).
- Negative number: a number less than zero.
- Degree: a unit for measuring turns and angles; a full turn is 360 degrees.
- Direction: the way a sprite faces, measured in degrees.
- Initialise: set things to their starting state when a program begins.
- Glide: move smoothly to a position over time.
- Pseudocode: a plan for a program written in plain words.
Keep learning with Byte by Byte
Explore Book 4: Office Apps and First Programs. Find the ebook, purchase details and teaching slides on MemuniCity.
Comments
Post a Comment