Dojo Defender Session 5: Demo

How to demo the solution

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

    • In the MENU you see the parallax star background scrolling (three speeds)
    • SPACE starts the game
    • Move the ship — see orange exhaust fumes under the engine
    • Shoot an enemy — 8-12 particles fly in all directions
    • Let an enemy escape — 3-5 white sparks at the bottom
    • Shoot a big asteroid — it splits into two medium ones
    • Shoot a medium asteroid — it splits into two small ones
    • Shoot a small asteroid — it disappears with a particle explosion
  2. Code highlights to show:

    • init_stars() with the three layers and speeds
    • spawn_particles() and the particle dictionary structure
    • update_particles() with the [:] slice for safe removal
    • draw_particles() with ratio fading (alpha fade)
    • split_asteroid() with recursive splitting
    • reset_game() with particles.clear()