<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Dojo Defender: Session 7 :: CoderDojo Python &amp; Pygame</title><link>https://python.coderdojohasselt.be/en/dojo-defender/session-7/index.html</link><description>Today you decide what happens in Dojo Defender. No step-by-step instructions — pick a feature, plan it, and build it.
You start from the complete Dojo Defender with everything on it: ship, asteroids, 3 enemy types, waves, particles, parallax stars, and a final boss with 3 phases.
This is your game. Make something of it.
Choose what you want to build Below are some ideas. Pick one — or come up with your own feature.</description><generator>Hugo</generator><language>en</language><atom:link href="https://python.coderdojohasselt.be/en/dojo-defender/session-7/index.xml" rel="self" type="application/rss+xml"/><item><title>Dojo Defender Session 7: Cheatsheet</title><link>https://python.coderdojohasselt.be/en/dojo-defender/session-7/cheatsheet/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python.coderdojohasselt.be/en/dojo-defender/session-7/cheatsheet/index.html</guid><description>Power-up variables powerups = [] # list of power-up GameObjects active_powerup = None # 'spread', 'shield', 'speed' or None powerup_timer = 0 # frames remaining Spawning a power-up (on enemy death) def spawn_powerup(x, y): if random.random() &lt; 0.2: # 20% chance ptype = random.choice(['spread', 'shield', 'speed']) pu = GameObject(f'powerup_{ptype}.png', x, y) pu.pu_type = ptype pu.speed = 2 powerups.append(pu) Collecting a power-up for pu in powerups[:]: pu.rect.y += pu.speed if pu.rect.top > HEIGHT + 30: powerups.remove(pu) elif pu.rect.colliderect(ship.rect) and ship.visible: active_powerup = pu.pu_type powerup_timer = 300 # 5 seconds powerups.remove(pu) Timer for the active power-up if active_powerup: powerup_timer -= 1 if powerup_timer &lt;= 0: active_powerup = None Spread shot (3 bullets) if active_powerup == 'spread' and shoot_cooldown == 0: angles = [-15, 0, 15] for a in angles: rad = math.radians(a) bullet = GameObject('bullet.png', x, y) bullet.dx = math.sin(rad) * 3 bullet.dy = -8 bullets.append(bullet) shoot_cooldown = 10 For normal shooting: bullet.dx = 0 and bullet.dy = -8.</description></item><item><title>Dojo Defender Session 7: Coach notes</title><link>https://python.coderdojohasselt.be/en/dojo-defender/session-7/mentor-notes/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python.coderdojohasselt.be/en/dojo-defender/session-7/mentor-notes/index.html</guid><description>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):</description></item><item><title>Dojo Defender Session 7: Demo</title><link>https://python.coderdojohasselt.be/en/dojo-defender/session-7/demo/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python.coderdojohasselt.be/en/dojo-defender/session-7/demo/index.html</guid><description>How to demo the solution Open a terminal in the project folder. Run: uv run python3 code/sessions/08-sky-highway/dojo-defender-solution/main.py Show:
Menu: shows the high score (0 the first time) SPACE starts the game Power-ups spawn: shoot enemies until a power-up drops (20% chance) Blue power-up (spread shot): shows “SPREAD SHOT: 5s” at the top, fires 3 bullets Green power-up (shield): shows “SHIELD: 5s”, shield aura around the ship, absorbs 1 hit Yellow power-up (speed boost): shows “SPEED BOOST: 5s”, ship moves 2x faster Game over: shows the score, the high score, and “NEW HIGH SCORE!” on a record Restart: the new high score is saved Code highlights to show:</description></item></channel></rss>