<?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 :: CoderDojo Python &amp; Pygame</title><link>https://python.coderdojohasselt.be/en/dojo-defender/index.html</link><description>Dojo Defender is our house game: a top-down survival shooter that we build together over several sessions.
Who is it for? Dojo Defender is for ninjas who come along regularly. The game grows along with the normal lessons over 7 sessions. Only drop by now and then? No problem: do the mini-game of that session. It is always complete on its own.
Don’t count on a complete Dojo Defender if you miss a lot of sessions. But the template and all the snapshots are on this site, so building on at home is always possible.</description><generator>Hugo</generator><language>en</language><atom:link href="https://python.coderdojohasselt.be/en/dojo-defender/index.xml" rel="self" type="application/rss+xml"/><item><title>Dojo Defender: Session 1</title><link>https://python.coderdojohasselt.be/en/dojo-defender/session-1/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python.coderdojohasselt.be/en/dojo-defender/session-1/index.html</guid><description>Your spaceship has landed in dark space. Time to bring it to life. In this session you add a ship you can steer and you make asteroids fall down. Dodge them or lose a life. How long do you survive?
What you’ll learn today Using lists to keep track of multiple asteroids Spawning and removing objects Detecting collisions with colliderect Keeping track of lives and showing an explosion effect Forcing game over when your lives run out Step 0: Setup Open Thonny. Download the Dojo Defender starter, unpack the ZIP and open main.py. Click Run. You see a dark blue screen with your spaceship at the bottom. You can already move it with the arrow keys. Problems? Take a look at Installing Thonny. Step 1: Let asteroids spawn A game without danger is boring. Add a list in which you keep track of all the asteroids, and a function that creates new asteroids:</description></item><item><title>Dojo Defender: Session 2</title><link>https://python.coderdojohasselt.be/en/dojo-defender/session-2/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python.coderdojohasselt.be/en/dojo-defender/session-2/index.html</guid><description>Your ship has a weapon now. Enemies are coming. Shoot them down before they reach the bottom. Every 10 enemies means a new wave — and it gets harder and harder.
What you’ll learn today Shooting with the space bar and a cooldown Lists for bullets and enemies Collision between bullets and enemies Waves that get harder and harder Enemies that make sine movements Step 0: Open the starter Open Thonny. Download the Dojo Defender starter for today, unpack the ZIP and open main.py. Were you not there last time? Download the solution from session 1 and start with that. Click Run. You see the same game as last time: ship, asteroids, explosions. Problems? Take a look at Installing Thonny. Step 1: Shooting with SPACE Your ship has a laser cannon. Add a list for bullets at the top:</description></item><item><title>Dojo Defender: Session 3</title><link>https://python.coderdojohasselt.be/en/dojo-defender/session-3/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python.coderdojohasselt.be/en/dojo-defender/session-3/index.html</guid><description>Today Dojo Defender moves from pgzero to real pygame. No more pgzrun.go() — you write the game loop yourself. The game stays the same, but the engine underneath is different. And at the end you add SOUND.
What you’ll learn today The difference between pgzero and raw pygame Writing the game loop yourself: while running: clock.tick(60) Converting actors to Surface + Rect Loading and playing sound with pygame.mixer Looping background music Step 0: Download the starter Today’s starter is a full port of Dojo Defender Session 2 to raw pygame. No more pgzero, but it plays the same.</description></item><item><title>Dojo Defender: Session 4</title><link>https://python.coderdojohasselt.be/en/dojo-defender/session-4/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python.coderdojohasselt.be/en/dojo-defender/session-4/index.html</guid><description>Today Dojo Defender becomes a real game with a menu. No more black start — you get a title screen, a game-over screen, and three different enemy types that each move in their own way.
What you’ll learn today State machines: your game has states (MENU, PLAYING, GAME OVER) Enemy AI: every enemy moves differently (straight, zigzag, charger) Wave system: increasingly hard waves with a mix of enemies A reset function: putting everything back neatly without restarting Step 0: Download the starter The starter is the solution of session 3 — Dojo Defender in raw pygame with sound.</description></item><item><title>Dojo Defender: Session 5</title><link>https://python.coderdojohasselt.be/en/dojo-defender/session-5/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python.coderdojohasselt.be/en/dojo-defender/session-5/index.html</guid><description>Today you give Dojo Defender a depth effect with a parallax star background and explosion particles. Asteroids also become destructible: big asteroids split into smaller ones.
What you’ll learn today Parallax maths: several layers of stars with their own speed Particle lists: a list of dictionaries for particles Position-based effects: spawning particles in the right spot Recursive splitting: big asteroid → 2 medium → 2 small → gone Step 0: Download the starter The starter is the solution of session 4 — Dojo Defender with a menu, three enemy types and waves.</description></item><item><title>Dojo Defender: Session 6</title><link>https://python.coderdojohasselt.be/en/dojo-defender/session-6/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python.coderdojohasselt.be/en/dojo-defender/session-6/index.html</guid><description>Today you add a final boss to Dojo Defender. The boss appears every 5 waves and has 3 phases with their own behaviour. You learn to work with a state machine of its own, HP bars and screen effects.
What you’ll learn today State machine for a boss: PHASE_1, PHASE_2, PHASE_3 and EXPLODING Drawing an HP bar with a colour gradient (green → yellow → red) Homing bullets: a bullet that moves towards the player Screen shake: a random offset on the drawing coordinates Phase transitions with visual effects Step 0: Download the starter The starter is the solution of session 5 — Dojo Defender with parallax stars, particles and splitting asteroids.</description></item><item><title>Dojo Defender: Session 7</title><link>https://python.coderdojohasselt.be/en/dojo-defender/session-7/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python.coderdojohasselt.be/en/dojo-defender/session-7/index.html</guid><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></item><item><title>Progress per session</title><link>https://python.coderdojohasselt.be/en/dojo-defender/progression/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://python.coderdojohasselt.be/en/dojo-defender/progression/index.html</guid><description>DD Session After curriculum What is new? Snapshot 1 S2 Spaceship + asteroids + lives + explosions (follows) 2 S3 Shooting + enemies + score + waves (follows) 3 S4 (Pygame) Rebuilt in Pygame with sprites + sound (follows) 4 S5 Menu + 3 enemy types (follows) 5 S6 Parallax stars + particles + splitting asteroids (follows) 6 S7 Boss fight with 3 phases + HP bar (follows) 7 S8 Your own version (power-ups, high score, …) (follows)</description></item></channel></rss>