- Learnt27 min · a floor, a serve, a score
- Basic25 min · build the game you can lose
- Challenge 1–327 min · a miss you feel, a fair serve, a score that compares
- Extrabonus · an extra life you have to catch
Review — where we got to 5 min
The ball bounces off all four walls and off the paddle. Nothing can go wrong yet.
move (6) stepsandif on edge, bounce, for ever.- The paddle bounce points the ball somewhere between −45 and 45.
Quick-fire
if on edge, bounce bounces off the bottom too. So how do we stop it?
Reveal the answer
We do not. We put something in front of the bottom edge, so the ball is caught before it ever gets there.
Today’s Topic 3 min
- A floor sprite that sits in front of the bottom edge
- A serve: putting the ball back in play after a miss
- A score that counts bounces, and three lives that count misses
- Why a game needs a pause between a mistake and the next chance
Learning outcome
By the end of this lesson you will be able to:
- Take a life when the ball reaches the floor.
- Serve the ball back into play from the middle.
- End the game at zero lives and show the rally you managed.
Learnt — a floor, a serve, a score 27 min
1 · A floor in front of the wall
The bottom edge already bounces, and there is no Level 1 block that turns off one edge. So we never let the ball reach it.
- Add a second Paddle sprite. Name it
Floor. - Stretch it wide:
set size to (560) %. - Put it low:
go to x: (0) y: (-200). - Check the gap. The paddle sits at
-140. The floor is a thick bar, so at-200only its top edge shows, at about-158. - Give the floor a
go to [back v] layerso the ball is always drawn on top of it.
when flag clicked
set size to (560) %
go to x: (0) y: (-200)
go to [back v] layer
show
How to use this: Click the green flag and watch the ball drop onto the bar along the bottom. Nothing to press.
2 · The serve
A miss costs a life and then puts the ball back. The pause matters: a ball that reappears instantly is a ball you lose twice.
- In the ball’s forever loop, add
if <touching [Floor v]?> then. - Inside it: a sound,
change [lives v] by (-1). - Then
go to x: (0) y: (0)andwait (1) seconds. - Then
point in direction (pick random (135) to (225)). - Play it. Miss on purpose and watch the ball come back.
if <touching [Floor v]?> then
start sound [Squawk v]
change [lives v] by (-1)
go to x: (0) y: (0)
wait (1) seconds
point in direction (pick random (135) to (225))
end
How to use this: Click the green flag and watch. Every time the ball reaches the floor it costs a life and is served again from the middle.
3 · Bounces are the score
The rally is the achievement in this game, so the number of paddle bounces is the score. Three misses ends it.
- Make
scoreandlives. Set them on the flag: 0 and 3. - In the paddle-touching if, add
change [score v] by (1). - Under the life being taken, add
if <(lives) = (0)> thenwith a broadcast in it. - On the paddle, receive the message, say the score, and stop all.
- Play three whole games.
when I receive [game over v]
say (join [Longest rally: ] (score)) for (3) seconds
stop [all v]
How to use this: Click the green flag, click the stage once, then hold ← or → to slide the paddle. Three misses and the game is over.
Basic — build the game you can lose 25 min
Open last week’s project. The ball and paddle stay exactly as they are.
Step 1 — the floor
- Add it, stretch it, place it below the paddle.
- Send it to the back layer.
- Check the ball can touch it without touching the paddle first.
Step 2 — losing a life
- Make the lives variable and set it to 3 on the flag.
- Add the floor-touching if to the ball.
- Miss three times on purpose. It should cost exactly three.
Step 3 — the serve
- Send the ball to the middle after a miss.
- Add the wait.
- Point it downward at a random angle.
Step 4 — the score
- Make the score variable and set it on the flag.
- Add the point inside the paddle-touching if.
- Play until it reads at least ten.
Step 5 — the ending
- Broadcast at zero lives.
- Receive it on the paddle, say the score, stop all.
- Play three games and write down the three scores.
A single miss takes all three lives.
The ball is still touching the floor next time round the loop. The go to x: (0) y: (0) has to happen before the loop comes round again — check it is inside the if.
The ball bounces off the floor instead of being lost.
The floor is below the bottom edge, so if on edge, bounce gets there first. Move the floor up.
The score goes up while the ball sits on the paddle.
The move-clear block after the paddle bounce is missing, so the ball counts a bounce every frame.
The ball is hidden behind the floor.
go to [back v] layer is missing from the floor, or was put on the ball by mistake.
Make a miss hurt
A life vanishing quietly is a life nobody noticed losing. Make the moment unmistakable.
- Something you hear.
- Something you see.
- A pause long enough to know what happened.
A serve nobody can complain about
A serve straight at the corner is not a challenge, it is a robbery. Find the range of angles that is fair, and use it.
- Every serve can be reached by a player who is paying attention.
- No serve is free.
- You have tried at least ten serves to check.
Teacher note — the range, and the paddle’s speed
Fairness here is a race between the ball and the paddle. A slower serve or a faster paddle both fix an unfair one, and pupils should notice they have two dials, not one.
A score worth comparing
Your score has to let two games be compared honestly — yours today against yours tomorrow, or yours against anybody else’s. Decide what it measures, then prove it works.
- You can say in one sentence what the number counts.
- You play two games under exactly the same rules.
- The higher number belongs to the better game, every time.
Teacher note — total bounces or longest rally
Total bounces rewards surviving; longest rally rewards one good run. Both are defensible and the argument is the lesson. Longest rally needs a second variable and a comparison — the same shape as the best score in Topic 1.39.
An extra life you have to catch
Every so often a heart falls from the top. Catch it with the paddle and you get a life back — but you cannot chase it and the ball at once.
How to use this: Click the green flag, click the stage once, then hold ← or → to catch the falling hearts. Lives never go above three.
- A heart falls now and then, not constantly.
- Catching it gives a life back.
- Lives never go above three.
- Missing a heart costs nothing.
Teacher notes — the cap, and where the tension comes from
if <(lives) < (3)> then around the change is what stops a hoard of nine lives. A pupil who skips it will find the game becomes unloseable, which is a fine thing to discover by playing.
The tension only exists if the heart falls somewhere the paddle is not. A heart at pick random (-200) to (200) does that by itself.
Going further: next lesson there is something up there to break, and the ball gets faster with every one.
Summary 4 min
The ball can be lost now, so keeping it up is worth something.
- The floor is a sprite in front of the bottom edge, because the edge always bounces.
- A miss costs a life and serves the ball again from the middle.
- The pause after a miss is what stops one mistake becoming three.
- Bounces are the score, and three misses end the game.
- Floor
- A sprite across the bottom. Touching it is a miss.
- Serve
- Putting the ball back into play, in a new direction, after a pause.
- Rally
- Bounces in a row with no miss. Some games score this instead of the total.
- Layer
- Which sprite is drawn in front. The floor belongs at the back.
Next lesson: targets to break, a ball that gets faster, and a paddle that gets smaller.