Score and lives: the numbers that make it a game
What turns 'moving shapes' into a game? Numbers to chase. Points that climb when you do well, and lives that drop when you slip.
The big idea
Score and lives are numbers the game tracks — points go up, lives go down — and shows on the screen.
See it in code
Underneath, score and lives are just numbers. Score starts at 0 and goes up; lives start at 3 and go down:
score = 0
lives = 3
score = score + 100
lives = lives - 1
print("Score:", score, "Lives:", lives)Score: 100 Lives: 2
Add to the score, take from the lives. That up-and-down is the heart of every scoreboard.
The HUD holds those numbers and shows them. We add_score(100), then draw it at the top of the screen:
from game import Stage, HUD
screen = Stage.create()
Stage.clear(screen)
hud = HUD()
hud.add_score(100)
print("Score:", hud.score)
hud.draw(screen)Score: 100

The HUD started with 3 lives and now shows a score of 100. It keeps the numbers for you and paints them on screen.
Now let a whole turn play out. The player scores twice with add_score, loses one life with lose_life, and the HUD shows the new totals:
from game import Stage, HUD
screen = Stage.create()
Stage.clear(screen)
hud = HUD()
hud.add_score(100)
hud.add_score(50)
hud.lose_life()
print("Score:", hud.score, "Lives:", hud.lives)
hud.draw(screen)Score: 150 Lives: 2

Two scores of 100 and 50 make 150, and one lost life leaves 2. The HUD shows both at a glance — that's how a player knows how they're doing.
Almost every game keeps score of something: points, coins, time, health, laps. The pattern is the same — a number goes up for good moves and down for bad ones, and the screen shows it so the player can chase it.
Try it yourself
Add another add_score(200) and check the new total. Then take away all three lives with three lose_life() calls — what should the game do when lives reach 0?
The common mistake
Changing the numbers but never drawing them. add_score(50) updates the score inside the HUD, but the player won't see it until hud.draw(screen) puts it on screen each frame.
What it unlocks
Scoring builds on variables and collision detection, and pairs with game state to end the game.