Dojo Defender Session 7: Demo

How to demo the solution

  1. Open a terminal in the project folder.
  2. Run:
uv run python3 code/sessions/08-sky-highway/dojo-defender-solution/main.py
  1. Show:

    • Menu: shows the high score (0 the first time)
    • SPACE starts the game
    • Power-ups spawn: shoot enemies until a power-up drops (20% chance)
    • Blue power-up (spread shot): shows “SPREAD SHOT: 5s” at the top, fires 3 bullets
    • Green power-up (shield): shows “SHIELD: 5s”, shield aura around the ship, absorbs 1 hit
    • Yellow power-up (speed boost): shows “SPEED BOOST: 5s”, ship moves 2x faster
    • Game over: shows the score, the high score, and “NEW HIGH SCORE!” on a record
    • Restart: the new high score is saved
  2. Code highlights to show:

    • spawn_powerup() — spawn on enemy death
    • Power-up collection + timer in the game loop
    • save_highscore() / load_highscore() — reading and writing a file
    • Spread shot: angles = [-15, 0, 15] with math.sin() and math.cos()