Dojo Defender Session 6: Demo
How to demo the solution
- Open a terminal in the project folder.
- Run:
uv run python3 code/sessions/07-bug-zapper/dojo-defender-solution/main.pyShow:
- SPACE starts the game, shoot until wave 5
- Wave 5: the boss comes in from above
- HP bar at the top: green → yellow → red as HP drops
- Phase 1: drifting slowly, now and then a red bullet
- Phase 2: moving faster, more bullets, minions spawning
- Phase 3: screen shakes, 2 bullets at once
- Phase transition: boss flashes white
- Defeating the boss: big explosion + “BOSS DEFEATED!” + 500 points
- Ordinary waves continue after the boss
Code highlights to show:
start_boss()andcheck_boss_wave()— how the boss startsfire_boss_bullet()— homing bullet with vector maths- Boss update in the game loop:
if boss_phase == ... - Drawing the HP bar with
pygame.draw.rect - Screen shake:
screen_shake_x = random.randint(-3, 3) - EXPLODING phase: particle bursts