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

Lesson 19: Leveling Up โ€” Difficulty Scaling (Matthes Ch 14 ยง2)

Learning Intentions

Success Criteria

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

Play your L18 build for 90 seconds. Notice: every run feels exactly the same. The fleet speed doesn't change. Today we fix that.

๐Ÿ‘ I Do โ€” Teacher Demo

Live-split Settings into __init__ (static: screen size, colours, speedup_scale) + initialize_dynamic_settings() (mutable: ship/bullet/alien speeds). Add increase_speed() that multiplies all three by scale.

๐Ÿค We Do โ€” Build Together

Call self.settings.increase_speed() after fleet-clear. Call initialize_dynamic_settings() in _check_play_button (reset on new game). Each new fleet is faster.

๐Ÿš€ You Do โ€” Your Turn

Tune speedup_scale. Try 1.05 (gentle), 1.2 (stressful), 1.5 (brutal). Arcade quests cover static vs dynamic attributes.

  • Refactor Settings: static attrs in __init__, dynamic attrs in initialize_dynamic_settings
  • Add speedup_scale = 1.1 to static
  • Write Settings.increase_speed() that multiplies all speeds by speedup_scale
  • In _check_bullet_alien_collisions, after fleet-clear: self.settings.increase_speed()
  • Call self.settings.initialize_dynamic_settings() in _check_play_button (reset on new game)

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

Loading practice quests for this lesson...

Three tiers โ€” pick yours

Support

settings_v2_starter.py with split scaffolded

Core

type along

Extension

level banner + cap

Extensions

๐Ÿ“ Exit Ticket โ€” Coding Journal

Journal: why did we split Settings into two methods? What problem did it solve?

Evidence of Learning

Each new fleet is faster. Reset clicks bring speeds back to start.

โ† PreviousLesson L18โ†‘ HubAll LessonsNext โ†’Lesson L20