Dojo Defender Session 4: Demo

How to demo the solution

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

    • The game starts in the MENU with the “DOJO DEFENDER” title and “Press SPACE to start”
    • SPACE starts the game and resets all the values
    • Three enemy types:
      • Drone (blue, square) — moves straight down
      • Zigzag (red, triangular) — moves diagonally, bounces off the edges
      • Charger (yellow, pointed) — follows the ship horizontally
    • Wave system: Wave 1 only drones, Wave 2-3 drones + zigzag, Wave 4+ chargers too
    • Game over: shows “GAME OVER” with the score and “Press SPACE to restart”
    • State transitions: MENU → PLAYING → GAME_OVER → PLAYING
  2. Code highlights to show:

    • state = "MENU" and the three branches in the drawing loop
    • reset_game() function with all the global variables
    • spawn_enemy_drone(), spawn_enemy_zigzag(), spawn_enemy_charger()
    • The movement per enemy.type in the game loop
    • spawn_enemy() with wave-based selection