Dojo Defender Session 5: Demo
How to demo the solution
- Open a terminal in the project folder.
- Run:
uv run python3 code/sessions/06-platformer/dojo-defender-solution/main.pyShow:
- 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
Code highlights to show:
init_stars()with the three layers and speedsspawn_particles()and the particle dictionary structureupdate_particles()with the[:]slice for safe removaldraw_particles()with ratio fading (alpha fade)split_asteroid()with recursive splittingreset_game()withparticles.clear()