Lesson at a glance
maze.education/microbit/lessons/catch-game
- Grades
- Grades 6 to 9
- Time
- 45 to 60 minutesThe CAPS gives Coding and Robotics 2 hours a week (Coding and Robotics CAPS, Grades 4 to 6, page 22; Grades 7 to 9, page 22).
- Level
- Confident codersFor confident classes: more steps to build, with variables, radio or data.
- Board
- Any micro:bit
- Code with
- MakeCode blocks, with Python as an extension
- CAPS
- Coding and Robotics, MathematicsFits: Grade 8, Term 2 · Where it fits
Learning intentions
Learners will learn to:
- Use x and y coordinates to place and move sprites on the 5 by 5 display.
- Use a loop, a condition and a score to build game rules.
- Describe a game's mechanics: what the player does, what the game does and how you win or lose.
Success criteria
Each learner can say:
- I can give the x and y coordinates of any light on the display, and place a sprite there.
- I can explain how the loop and the two conditions decide whether the player scores or loses.
- I can describe my game's mechanics: what the player does, what the game does and how it ends.
- Grades 7 to 9: I can trace the drop's position and the score through several passes of the loop.
Competencies
From the Coding and Robotics CAPS places this lesson cites.
- R.7Create, test and execute a set of robotic instructions
Key words
- sprite
- A single light that a game can move, like a character.
- coordinates
- Two numbers, x across and y down, that give a position on a grid.
- game mechanics
- The rules and actions that make a game work.
- score
- A number that counts how well the player is doing.
- iteration
- Testing, changing and testing again to make something better.
- trace table
- A table that follows the value of each variable, step by step, as a program runs.
What you need
- One micro:bit per learner or pair, with a USB cable and a battery holder
- A computer with Chrome or Edge for each learner or pair
- Squared paper for planning
From our shop: BBC micro:bit V2 Go, BBC micro:bit V2.21 Next Gen Classroom Pack
Safety
- Keep USB cables tidy on the desk so nobody trips over them or pulls a laptop off the table.
- Use the battery holder with two AAA batteries. Never mix old and new batteries, and take the batteries out before the kits are packed away.
- Unplug the battery holder by holding its plug, never by pulling the wires.
The lesson plan
One lesson of 45 to 60 minutes in three parts: introduction, lesson development and consolidation. The CAPS gives Coding and Robotics 2 hours a week, so it fits one of the week's lessons. Times are a guide.
Introduction
5 to 10 minutesRetrieval practiceWhat is a condition in a program? (A question with a yes or no answer, such as whether the drop has reached the bottom row.)
Problem statementAt the school's open day, the Coding and Robotics club wants a game that visitors can learn in ten seconds and play in a minute. Code a catch game on the micro:bit with clear rules, a score and a way to lose, then improve it after classmates have played it.
- Draw a 5 by 5 grid on the board, numbered 0 to 4 across (x) and 0 to 4 down (y). Ask learners to name the coordinates of a few squares. Point out that y counts down from the top, unlike a graph in Mathematics.
- Read the problem statement together. Ask: what makes a simple game easy to learn? Agree on three mechanics for our game: things fall, you catch them, you lose if you miss.
Lesson development
35 to 40 minutes- Unplugged first. Play it on the grid on the board: one learner draws the drop in row 0 and moves it down one square at each clap; another moves the basket along row 4, one square left or right per clap. Did the basket get there in time? What decides a catch?
- Plan on paper first. Pairs write the algorithm, then draw the flowchart for one pass of the game loop. Learners in Grades 7 to 9 add the trace table: the basket's x, the drop's x and y, and the score for six passes.
- Predict. Show the finished blocks and ask: what are the basket's coordinates after A is pressed twice from the start? What will happen if A is pressed five times? How many passes of the loop does a drop take to reach the bottom row?
- Build in blocks. Pairs share one computer. The driver builds the two sprites and the buttons from the Blocks tab; the navigator holds the algorithm and the flowchart, and checks each block against them. Swap roles halfway, after step 3, so the new driver builds the falling drop and its two conditions.
- Test and debug. Test in the simulator: move the basket, catch one drop and miss the next on purpose. Did it match your predictions and the flowchart? If the basket moves up or the drop never comes back, check the common mistakes. Then download it, play and note your score.
- Iterate: make one change to improve the game, such as speeding up as the score rises, and test it on another pair. Then write the game's mechanics in three sentences: what the player does, what the game does and how it ends.
Plan on paper: a model answer
In pairs, write the algorithm, then draw the flowchart for one pass of the game loop. Grades 7 to 9 also trace the basket, the drop and the score for six passes.
Algorithm
- Create the basket at x 2, y 4, and the drop at a random x from 0 to 4, y 0.
- When A is pressed, move the basket one light left. When B is pressed, move it one light right.
- Over and over: wait 400 milliseconds and move the drop down one row.
- If the drop is on row 4 and touching the basket, add 1 to the score and send the drop back to row 0 at a random x.
- If the drop is on row 4 and not touching the basket, the game is over.
Flowchart
- Wait 400 milliseconds
- Move the drop down one row
- Is the drop's y 4?Yes: ask the next questionNo: go back to the start of the loop
- Is the drop touching the basket?Yes: add 1 to the score and send the drop to a random x on row 0No: game over, and show the score
- Back to the start of the loop
Trace table
Grades 7 to 9: six passes of the loop. The drop starts at x 1, and A is pressed once before the first pass. Pass basket x drop x drop y score What happens Start 2 1 0 0 Both sprites appear 1 1 1 1 0 A has moved the basket; the drop falls 2 1 1 2 0 The drop falls 3 1 1 3 0 The drop falls 4 1 1, then 3 4, then 0 1 Caught: the drop goes back to row 0 at a random x, here 3 5 1 3 1 1 The drop falls 6 1 3 2 1 The drop falls: press B twice, or it will be missed Consolidation
5 to 10 minutes- Ask: what are the coordinates of the basket when the game starts? What is the condition for losing?
- Pairs share the change they made and whether it made the game better for the pair who tested it.
- Back to the problem: could a visitor at open day learn your game in ten seconds? Write its rules on a card in two sentences. Learners check themselves against the success criteria.
Build it, step by step
Pairs build the program in blocks, following the numbered steps, with the same program as text beside them to check against or paste. Test in the simulator before sending it to a board.
These are the MakeCode steps. The other routes are on the lesson's web page.
Build it in MakeCode blocks
- Start a New Project. Open Advanced, then Game.
- Make variables basket and drop. In on start, set basket to create sprite at x 2 y 4, and drop to create sprite at x pick random 0 to 4 y 0.
- Add on button A pressed with basket change x by -1, and on button B pressed with basket change x by 1.
- In forever: pause (ms) 400, then drop change y by 1.
- Add an if: drop y = 4. Inside it, an if then else: if is drop touching basket, then change score by 1 and set drop's x to a random 0 to 4 and its y to 0. Else game over.
- Test in the simulator, then Download.
let basket = game.createSprite(2, 4)
let drop = game.createSprite(randint(0, 4), 0)
input.onButtonPressed(Button.A, function () {
basket.change(LedSpriteProperty.X, -1)
})
input.onButtonPressed(Button.B, function () {
basket.change(LedSpriteProperty.X, 1)
})
basic.forever(function () {
basic.pause(400)
drop.change(LedSpriteProperty.Y, 1)
if (drop.get(LedSpriteProperty.Y) == 4) {
if (drop.isTouching(basket)) {
game.addScore(1)
drop.set(LedSpriteProperty.X, randint(0, 4))
drop.set(LedSpriteProperty.Y, 0)
} else {
game.gameOver()
}
}
})To use the text instead: open MakeCode, start a new project, click JavaScript at the top, replace what is there with this code, then click Blocks to see it as blocks.
To send it to the board, click Download. In Chrome or Edge, MakeCode can connect to the micro:bit by USB so the program goes straight onto it. Otherwise a .hex file downloads: drag it onto the MICROBIT drive.
No Purple Mash route for this lesson
We could not find a Purple Mash unit or project that matches this lesson, so it is MakeCode blocks, with Python as an extension. These lessons have a Purple Mash route:
Extension: text-based coding, beyond the CAPS
The same program in MicroPython, for the micro:bit Python Editor. It suits Grade 7 to 9 learners who are ready for text-based code. The CAPS itself follows a block-based approach (Coding and Robotics CAPS, Grades 7 to 9, page 24).
# Catch the drop: A and B move the basket along the bottom row. Miss once and the game is over.
from microbit import *
import random
basket = 2
drop_x = random.randint(0, 4)
drop_y = 0
score = 0
last_fall = running_time()
while True:
if button_a.was_pressed() and basket > 0:
basket = basket - 1
if button_b.was_pressed() and basket < 4:
basket = basket + 1
if running_time() - last_fall > 400:
last_fall = running_time()
drop_y = drop_y + 1
if drop_y == 4:
if drop_x == basket:
score = score + 1
drop_x = random.randint(0, 4)
drop_y = 0
else:
break
display.clear()
display.set_pixel(basket, 4, 9)
display.set_pixel(drop_x, drop_y, 5)
sleep(20)
display.show(Image.SAD)
sleep(1000)
display.scroll("Score " + str(score), loop=True)MicroPython has no sprites, so the Python version keeps the positions in variables and draws the two lights itself: a dimmer drop and a brighter basket.
Open the Python editor, replace the code that is there with this program (or open the downloaded file), then click Send to micro:bit. MakeCode also has a Python view, which is written a little differently.
Extension or homework
Challenges for learners who finish early, or to take further in a club or as homework.
- Challenge 1
Ask classmates to play and score your game out of 10 for fun and for fairness, then improve the lowest score.
- Challenge 2
Add a bonus drop that is worth two points and falls faster.
- Challenge 3
Use tilt instead of buttons: move the basket with acceleration (mg) x.
Support and extension
Support
For learners who need more help
- Give learners the sprites and buttons already built, and build the falling drop together, one block at a time against the flowchart.
- Slow the game down: change the pause to 800.
Extension
For learners who are ready for more
- Speed up as the score rises: pause for 400 minus score times 20, and stop it going below 100.
- Add a second drop, or give the player three lives with set life and remove life from Game.
Informal assessment
Ask these as learners work. Informal assessment happens every day and is not recorded.
- What are the coordinates of the bottom-left light?
- Which block makes the drop fall, and how often does it run?
- What has to be true for the player to score?
Name one change you made after testing, and why you made it.
Observation checklist
Watch pairs as they plan, build and test. Write each pair's initials under the level you see.
| Watch for | Beginning | Developing | Accomplished | Exemplary |
|---|---|---|---|---|
| Names coordinates correctly, with x across from the left and y down from the top. | ||||
| Follows the flowchart while building, as driver or navigator. | ||||
| Predicts what the game will do before testing, and checks it in the simulator. | ||||
| Makes one change after testing and explains how it improves the game. |
- Beginning:
- not yet, even with help
- Developing:
- with help
- Accomplished:
- on their own
- Exemplary:
- on their own, and explains it or takes it further
The four levels are the CAPS rubric levels (Coding and Robotics CAPS, Grades 4 to 6, page 176; Grades 7 to 9, page 163). The short descriptions are ours.
This lesson is not a formal task, but it is good practice for the term's practical task in Grades 4 to 6 (Coding and Robotics CAPS, Grades 4 to 6, page 170), and for the mini-PATs in Grades 7 to 9 (Coding and Robotics CAPS, Grades 7 to 9, page 157).
Common mistakes and fixes
- The basket goes up instead of sideways.Use change x, not change y, in the button blocks.
- The drop never comes back to the top.Check you set the drop's y to 0 after a catch, not its x.
- It is game over straight away.Check the if tests drop y = 4 before the touching test, and the basket starts at y 4.
Where it sits in CAPS
- Coding and RoboticsFitsGrade 8, Term 2: a micro:bit game where a basket of lights catches a falling dot (the CAPS catch the dot game).Source: Coding and Robotics CAPS, Grades 7 to 9, Grade 8, Term 2, Robotics, R.7 Create, test and execute a set of robotic instructions, page 110:
The purpose of this game is to navigate a basket (LED bar) to “catch” other LED lights.
- Coding and RoboticsFitsGrade 8, Term 2: keep count of the dots caught and show the score.Source: Coding and Robotics CAPS, Grades 7 to 9, Grade 8, Term 2, Robotics, R.7 Create, test and execute a set of robotic instructions, page 110:
When Button A is pressed, display the number of dots that you caught with the basket.
- MathematicsFits Mathematics: naming points on a grid with x and y coordinates.
Coding and Robotics quotes come from the Department of Basic Education's final CAPS, with the page number of the 2024 printed edition (the Department's October 2025 library copies number their pages differently). Schools may teach a topic in another term: the CAPS leaves the order to each school's annual teaching plan.
micro:bit is a trade mark of the Micro:bit Educational Foundation, and BBC is a trade mark of the British Broadcasting Corporation. Maze Education is an independent reseller of genuine BBC micro:bit products. Our teacher training and our other products and services are our own, and are not endorsed by the Foundation or the BBC.

