Mission 02 · Lesson 07
Loops and animation
Coding & Game Development
Work at your pace. Take a break between stages; there is no countdown.
You need: paper, a pencil and this lab. A helper is welcome for reading and discussion.Connect to what you know
Your game has movement and a condition. Use repetition to make a small animation without copying every action.
Understand it, step by step
- 1
A loop repeats a block a chosen number of times. “Repeat 3: move right 1” runs the move three times.
- 2
The counter is not the distance of one move. Total distance is repetitions × movement per repetition.
- 3
Predict, run, inspect, then change ONE value. A loop with one repetition too many is a common bug.
Watch a worked example
Repeat 2 × move 2: positions 0 → 2 → 4. Repeat 4 × move 1 also ends at 4, but visits more positions on the way.
Pause and predict
Will repeat 3 × move 2 visit square 3?