L20 ยท T2 Week 10 ๐ŸŽฏ CT5-DPM-01 ยท CT5-COM-01 ๐Ÿ“‚ Phase 2 โ€” Alien Invasion ยท Ch 14 Scoring + End

Lesson 20: Scoring HUD โ€” Font Rendering (Matthes Ch 14 ยง3-4)

Learning Intentions

Success Criteria

๐Ÿ“ Do Now โ€” Error of the Day

Open any arcade game on your phone. Screenshot the HUD (score, lives, level). What pieces does it show? In what corners?

๐Ÿ‘ I Do โ€” Teacher Demo

Live-code the Scoreboard class. Walk through the 3-step font pipeline: SysFont โ†’ render (returns Surface) โ†’ blit. Build prep_score() + show_score().

๐Ÿค We Do โ€” Build Together

Class adds scoring. Alien kill โ†’ self.stats.score += self.settings.alien_points * len(aliens). Call self.sb.prep_score(). Watch the score climb in the top-right.

๐Ÿš€ You Do โ€” Your Turn

Round the score to nearest 10 with round(score, -1). Tune font size + text colour. Arcade quests cover pygame.font.

  • Create scoreboard.py with class Scoreboard
  • __init__: store screen + stats + settings + font
  • prep_score(): render rounded score to a Surface; store score_image + score_rect
  • show_score(): blit score_image at score_rect
  • Add self.stats.score += self.settings.alien_points * len(aliens) in the collision check + self.sb.prep_score()

๐ŸŽฎ Practice Quests โ€” work through these

Loading practice quests for this lesson...

Three tiers โ€” pick yours

Support

Scoreboard skeleton with prep_score pre-written

Core

build from scratch

Extension

comma-thousands formatting

Extensions

๐Ÿ“ Exit Ticket โ€” Coding Journal

Journal: explain the 3 steps of rendering text in Pygame (SysFont โ†’ render โ†’ blit).

Evidence of Learning

Score updates every alien kill. Visible in top-right corner of screen.

โ† PreviousLesson L19โ†‘ HubAll LessonsNext โ†’Lesson L21