AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Animating with forever

Week 2 · Unit 1: Be an animator · 3 lessons
2

Start place, then move

Computing 4: Unit 1, pp. 8–19
GoalUse go to, move and wait blocks inside a forever loop to move a sprite to and fro.
New words
coordinates · a pair of numbers, x and y, that give a place on the stagex position · how far left or right a sprite is: minus is left, plus is righty position · how far up or down a sprite is: minus is down, plus is up
Explanation

Every place on the Scratch stage has two numbers. The x number says how far left or right it is, and the y number says how far up or down. The middle of the stage is x: 0, y: 0. The block “go to x: y:” puts a sprite at a start place. We put it just after the hat block, so the sprite starts in the same place every time. To move to and fro, put “move (40) steps” and “move (−40) steps” inside a forever loop with waits. A minus number moves the sprite backwards, which is to the left when it faces right. If both moves are the same size, the sprite swings between the same two places.

x 240−240y 180−180(−100, 100)(100, −100)
Worked examples
whenclickedgo to x:-90y:-50move60stepswait0.5secondsmove-60stepswait0.5secondsforever
A toy train starts at x: −90, y: −50 and faces right. It moves 60 steps, waits, moves back 60 steps and waits, again and again. So it swings between x: −90 and x: −30.
x 240−240y 180−180x −90x −30
The arrow shows the train’s first move of 60 steps to the right. The x number goes from −90 to −30. The y number stays at −50, because the train does not go up or down.
whenclickedgo to x:-90y:-50move60stepswait0.5secondsmove-45stepswait0.5secondsforever
If the sprite moves 60 steps right but only 45 steps back, each round it ends 15 steps further right. From x: −90 it is at −75 after round 1, then at −60 after round 2. It drifts to the right. For a sprite to stay in the same place, the two moves must be the same size.
Class activity

Floor line (with a friend): lay a long strip of tape or draw a chalk line on the floor. Write the numbers −3, −2, −1, 0, 1, 2, 3 on paper squares one big step apart. A friend stands on −2, the start place. Read this algorithm: move 2 steps right, wait, move 2 steps back, wait, and repeat forever. Where does your friend stand after each instruction? Now change it to move 3 right and 2 back each round. Where does your friend stand after 3 rounds?

Practice
1
Give the coordinates of the star A and the flag B.
x 240−240y 180−180AB
2
Between which two x positions does this sprite swing?
whenclickedgo to x:20y:0move45stepswait0.5secondsmove-45stepswait0.5secondsforever
3
This sprite drifts. Where is it at the end of round 2 after starting at x: 0? Why does it drift?
whenclickedgo to x:0y:0move25stepswait1secondsmove-20stepswait1secondsforever
4
Write the block that puts a sprite at the left of the stage at x: −150 and low down at y: −100.