- Learnt28 min · rounds, two scores, three endings
- Basic25 min · turn your race into a match
- Challenge 1–327 min · a scoreboard, best of five, hand it over
- Extrabonus · a handicap for the winner
Review — where we got to 5 min
You have a two-player obstacle race with a countdown. Everything today is a shape you have used already, on the biggest project of the level.
- The broadcast chain from the Quiz Show: one script finishes and calls the next.
- The
race onswitch from two lessons ago. - An if inside an else, from the medal card.
Quick-fire
You beat your friend once. They say it was luck. What would settle it, and what has to change in your project?
Reveal the answer
More races. Which means the project has to know how many have been run, who has won each, and when to stop — three things it does not currently know.
Today’s Topic 3 min
- A
roundcounter, and a referee who knows when the match is over - Two win counters, one per player
- Three endings: blue, red, and a draw
stop [all v]replaced by a broadcast, so the game can carry on
Learning outcome
By the end of this lesson you will be able to:
- Run a fixed number of rounds one after the other.
- Keep a score for two players at once.
- Declare a champion, including when there is not one.
Learnt — rounds, scores, a champion 28 min
1 · The winner stops stopping everything
stop [all v] is the block in the way. Nothing is left running afterwards, so nothing can start a second race. Replace it with a message.
when I receive [new round v]
go to x: (-200) y: (70)
wait until <touching [Finish v]?>
change [blue wins v] by (1)
say [Blue takes it!] for (2) seconds
broadcast [round over v]
The referee hears round over and decides what happens next. That decision is an if / else, and it is the whole of the match.
when I receive [round over v]
set [race on v] to (0)
wait (3) seconds
if <(round) > (2)> then
broadcast [match over v]
else
broadcast [new round v]
end
3 > 2 is true.2 · Two scores
Two players need two counters. Where they are SET is the interesting part, and it is the same rule as the Quiz Show’s best score.
| Set on the green flag | Set at the start of each round |
|---|---|
blue wins | race on |
red wins | Both rockets’ positions |
round | — |
Put a win counter in the right-hand column and every round wipes it, so the match is always 1–0 to whoever won last.
when I receive [new round v]
set [race on v] to (0)
change [round v] by (1)
say [3] for (1) seconds
say [2] for (1) seconds
say [1] for (1) seconds
set [race on v] to (1)
say [GO!] for (1) seconds
How to use this: Click the green flag to start it. Nothing else to press — watch it through, then use ↺ Reset to run it again.
3 · Three endings
Blue can win, red can win, and — with an even number of rounds, or a round nobody finishes — it can be level. Every match needs all three.
when I receive [match over v]
start sound [Triumph v]
if <(blue wins) > (red wins)> then
say [Blue is the champion!] for (4) seconds
else
if <(red wins) > (blue wins)> then
say [Red is the champion!] for (4) seconds
else
say [A draw! Race again.] for (4) seconds
end
end
How to use this: Click the green flag to start it. Nothing else to press — watch it through, then use ↺ Reset to run it again.
How to use this: Click the green flag, click the stage once, then race with D in one hand and → in the other. Three races decide the match.
Basic — turn your race into a match 25 min
This is a rewiring job. Almost every block you need already exists; what changes is which hat it hangs from.
Step 1 — the three variables
- Make
blue wins,red winsandround. - Show all three.
- Set all three to 0 on the referee’s green-flag stack.
- End that stack with
broadcast [new round v].
Step 2 — move the countdown
- Change the referee’s countdown hat from
when flag clickedtowhen I receive [new round v]. - Add
change [round v] by (1)near the top of it. - Press the flag. One countdown should run.
Step 3 — the winning scripts report
- Change each rocket’s winning hat to
when I receive [new round v]. - Put the
go to x: (-200) y: (70)block at the top of it. - Swap
stop [all v]forbroadcast [round over v]. - Add
change [blue wins v] by (1)before the message.
Step 4 — the referee decides
- Build the round-over script on the referee.
- Test it. Three countdowns should run, one after another.
- Check the round counter reaches 3 and stops.
Step 5 — the champion
- Build the match-over script with the if inside the else.
- Play a whole match, driving both rockets yourself.
- Play a second one and check everything starts from nothing.
The countdown runs for ever.
The round counter is not going up, so round > 2 is never true. The change block belongs in the new-round script, not the round-over one.
Round 2 is won instantly.
A rocket did not go back to its start line, so it is still touching the finish. The go to x: (-200) y: (70) is the first block of the winning script.
The score is always 1-0.
The win counters are being set to 0 in the new-round script. They belong on the green flag.
Both players score in the same round.
The race is not being switched off when somebody wins. The loser reaches the line during the three-second wait.
A scoreboard you can read while flying
Players in the middle of a race should not have to squint at the corner to know the score.
- The score is visible during the race, not only between rounds.
- Which round it is, is on screen.
- Nothing covers a lane or a rocket.
Best of five, decided early
Make it best of five — and stop as soon as one player has won three, instead of playing races that cannot change anything.
- Up to five rounds.
- A player who reaches three wins ends the match there and then.
- A 3–0 match plays three races, not five.
- A 3–2 match plays all five.
Teacher note — three questions, not one
The round-over script now asks three things: has blue won three, has red won three, or have we run out of rounds? Any of them ends the match. The tidy way is three ifs before the else, and the interesting mistake is checking the round count FIRST, which plays race four before noticing the match was already over.
Hand it to two strangers
The last challenge of Level 1. Two people who have never seen your game sit down and play a whole match. You say nothing.
- They work out which rocket is theirs.
- They work out which keys are theirs.
- They play three races without asking you anything.
- They know who won.
Teacher note — the keys have to be on the screen
This is the one thing almost every project fails on, and it is invisible to the author because they know their own keys. A line on the title screen, or a label under each rocket, is all it takes. It is the same lesson as the Quiz Show’s stranger test and the Pet Pal’s: whatever you wanted to say out loud belonged on the screen.
A handicap for the winner
A match between a fast player and a slow one is over after round one. Make winning a round cost you a little ground in the next.
How to use this: Click the green flag to start it. Nothing else to press — watch it through, then use ↺ Reset to run it again.
- Winning a round moves your start line backwards for the next one.
- Losing does not.
- Nobody ever starts off the left of the Stage.
- The handicap resets at the start of a new match.
Teacher notes — a start position that is a variable
when I receive [new round v]
go to x: (blue start) y: (70)
wait until <touching [Finish v]?>
change [blue wins v] by (1)
change [blue start v] by (-15)
broadcast [round over v]
The move worth naming: go to x: (blue start) y: (70) has a variable where every other one in the course has had a number. The rocket’s starting place is now something the game decides.
Keeping it on the Stage needs a floor. The honest Level 1 answer is a guard, added straight after the change block:
if <(blue start) < (-215)> then
set [blue start v] to (-215)
end
A pupil who asks whether there is a neater way has found the reason other languages have a block for “whichever of these two is bigger”. Scratch does not, so the guard is the answer here.
Going further: Level 2 opens with clones that each carry their own numbers, and a whack-a-mole game built on the mouse rather than the keyboard.
Summary 5 min
Thirty-six lessons ago the cat moved ten steps; today two people play a three-round match against each other.
stop [all v]ends a project. A broadcast ends a ROUND.- A referee holds the counters and decides when the match is over.
- Match scores live on the green flag; round state lives on the round.
- Three endings, tested in order, and one of them is the draw.
What the six arcs covered
- Moving, turning, gliding, and the Stage’s coordinates.
- Costumes, backdrops, saying, sound, and two things happening at once.
- Events, loops, if, if / else, and the questions Sensing can ask.
- Variables: as a score, as a countdown, as a mood, and as a switch.
- Clones, broadcasts, and a game with a title screen and an ending.
- Round
- One race. A match is several of them.
- Match
- A set of rounds with a winner decided at the end.
- Draw
- Nobody won. It needs its own ending, even when it seems impossible.
- Referee
- The sprite that holds the rules. It is played by nobody.
Next lesson: a new arc — one key, one hop, and a game that never lets you stand still.