Dojo Defender Session 7: Coach notes

Goal of this session

After this session a ninja can:

  • Come up with and plan a feature themselves using a simple step-by-step plan
  • Read and understand existing code to add something to it
  • Solve a problem independently with minimal coach guidance

This session is different from all the previous ones — no step-by-step instructions. The ninja chooses what they build.


Preparation (30 min before the session)

  • Starter ZIP ready on USB and on the site: dojo-defender-s8-starter.en.zip.
  • The starter is the complete DD S7 solution (boss + all features). Run it once on the dojo room laptop.
  • Agree with the other coaches on which ninjas do which feature, so there’s variation in the showcase.
  • Print a few planning templates (the Coach-guided planning block from the worksheet) for ninjas who prefer working on paper.

Schedule (3 hours)

This session is an integral part of the normal session 8 (Sky Highway):

TimeActivity
0:00 to 1:15Session 8: Sky Highway (Step 1-4)
1:15 to 1:30Dojo Defender intro: “Your game, your feature”
1:30 to 1:45Choosing a feature + planning (coach-guided)
1:45 to 2:30Building independently
2:30 to 2:50Showcase
2:50 to 3:00Buffer / tidying up

Coach role-play

This session is all about independence. Your role as a coach:

  1. Don’t solve too much. If a ninja gets stuck, ask questions instead of giving answers:

    • “What happens when you press SPACE?”
    • “Which variable has to change?”
    • “Where in the code is the ship?”
  2. Guarding the scope. Ninjas often want too much at once. Help them choose the smallest version that “works”. A working power-up is better than a half-finished combo system.

  3. Celebrating failure. If it doesn’t work, that’s educational too. Let them tell what went wrong and what they learned from it.


Common questions

“Power-ups don’t spawn” Check whether spawn_powerup() is called where an enemy dies (at the bullet-enemy collision). Also: random.random() < 0.2 is 20% — that’s not much. Have them temporarily make it 0.5 to test.

“Spread shot only fires 1 bullet” The bullet.dx and bullet.dy have to be added to the bullet update. Without those variables all bullets fly straight up. Add bullet.dx = 0 and bullet.dy = -8 when creating normal bullets, and bullet.rect.x += bullet.dx and bullet.rect.y += bullet.dy in the update loop.

“The power-up timer doesn’t reset after a restart” Don’t forget: active_powerup = None and powerup_timer = 0 in reset_game().

“The high score isn’t saved” save_highscore() has to be called on the game-over screen, before reset_game() is called. Otherwise the score is already 0.

“High score.txt keeps getting overwritten” The check if val > load_highscore() stops a lower score from overwriting the high one. Doesn’t that work? Have them add print() to debug.

“The ship is invisible after a restart” ship.visible = True has to be in reset_game(). Ninjas sometimes forget this.


Power-up implementation (for coaches)

The power-up solution works like this:

  • Spawn: spawn_powerup(x, y) is called where an enemy dies. 20% chance.
  • Collect: in the game loop we check whether a power-up hits the ship.
  • Timer: powerup_timer counts down every frame. At 0, active_powerup = None.
  • Spread shot: replaces normal shooting. Instead of 1 bullet, 3 bullets at an angle.
  • Shield: on a hit, active_powerup = None is set and invincible = True for 5 seconds.
  • Speed boost: ship_speed is doubled from 5 to 10.

Showcase

Let every ninja present for 30 seconds. Three fixed questions:

  1. What did you want to make?
  2. Did it work?
  3. What was the hardest part?

As a coach: always mention something specific that went well (“Nice that you added a timer”, “Clever that you worked out the high score file”).

Cliffhanger script

“Today you added your own feature to Dojo Defender. Next time we start on a completely new game — but Dojo Defender will always exist. Take it home and keep tinkering with it.”