🦍 Planning Workbook: Donkey Kong

How to use this workbook: work top to bottom. It walks you through planning Donkey Kong with the method from 01-How-to-Plan-a-Game, then gives you a build order. It says what each piece is and which technique to reach for — you open the Technique Playground and write the code. Wherever you see ✍️ YOUR TURN or a checkbox, that's your work.


The game in a nutshell

A big ape sits at the top of a construction site and rolls barrels down at you. You're the little hero at the bottom. Run along the girders, climb the ladders, and jump over the barrels as you make your way to the top to win.

This is a platformer, which means one big new idea compared to Pac-Man: gravity. Things fall down unless something holds them up.


Step 1 — Say it in one sentence

Starting version — ✍️ YOUR TURN: make it yours.

"Climb from the bottom to the top of the girders, jumping over rolling barrels along the way."


Step 2 — What's on the screen? (objects)

✍️ YOUR TURN: note the shape/color you'll use for each.


Step 3 — What does each object DO? (behaviors)

✍️ YOUR TURN: fill in the blanks.


Step 4 — The rules ("when ___, then ___")

Some done, some for you.


Step 5 — States (scenes)

TitlePlayingWin (reached the top) or Game Over (lives = 0) → back to Title.

(Technique 11 covers scenes.)


🧩 Your Architecture Map

Two rows filled in as examples. ✍️ YOUR TURN: complete the rest.

Object Shape & color What it does Collides with Components it needs Technique(s)
Hero small rect runs, jumps, climbs girders, barrels, ladders, goal pos, rect, color, area, body 4, 6, 7, 8
Girder long grey rect holds things up hero, barrels pos, rect, color, area, body({isStatic:true}) 7, 10
Ladder ? ? hero (overlap) pos, rect, color, area 8
Barrel ? ? hero, girders ? 6, 7, 9
Goal ? ? hero pos, rect, area 8, 11
Score/Lives text shows numbers pos, text 12

🏗️ Build order (your milestones)

Build one at a time. Run and check the "✅ works when" line before moving on.

Milestone 1 — Draw the level

Build the girders and ladders from a text map (Technique 10). Here's a starter — = is a girder, H is a ladder, P is where the hero starts, K is Donkey Kong, G is the goal. Paste it and then redesign it:

=                   =
=                   =
= K   H           G =
======H==============
=     H             =
=     H             =
=     H      H      =
=============H=======
=            H      =
=            H      =
=   H        H      =
====H================
=   H               =
=   H               =
=   H          H    =
===============H=====
=              H    =
=              H    =
= P            H    =
=====================

Turn each = into a solid girder (area + body({isStatic:true})), each H into a ladder (just area — no body, because you pass through ladders, you don't stand on them).

Use 32×32 tiles (tileWidth: 32, tileHeight: 32). The map is 21 tiles wide and 20 tall, so the level is 672 × 640 pixels — start your game with kaplay({ width: 672, height: 640, letterbox: true }) so the whole thing fits on screen.

🔑 Two things about this map are deliberate — don't "tidy" them away:

1. Every floor has three empty rows above it. That's your headroom. A jump needs somewhere to go, and a barrel needs somewhere to be jumped over. If you redesign the level, keep at least three blank rows between girders or Milestone 3 and Milestone 5 become impossible.

2. Each ladder pokes one tile above the floor it leads to, and replaces the girder it passes through. Look at the ladder in column 6: it runs from row 2 down to row 6, and the girder row 3 has an H instead of an = — that's the hole the hero climbs through. The tile sticking up above the floor is what lets him finish the climb and stand there without falling back down the hole. This geometry is what makes Milestone 4 work, so copy the pattern for any ladder you add.

💡 If your girders look right but the ladders sit hugging the corner of their tile, that's because a tile's position is its top-left corner, not its middle. Either make the ladder rectangle a full 32 wide, or nudge the object over after the level is built. Cosmetic only — don't let it block you.

Milestone 2 — The hero falls and lands

Turn on gravity (Technique 6: setGravity(...)). Add the hero as a body with an area. Drop him above a girder.

Milestone 3 — Run and jump

Read left/right keys to move the hero (Technique 4 + 5). Read the jump key (space) and make him jump — but only when he's on the ground (Technique 6 shows the isGrounded() check so he can't fly).

Milestone 4 — Climb ladders

This is the trickiest bit, so plan it before coding. A ladder is an area you can overlap. The idea: while the hero is overlapping a ladder and you press Up (or Down), move him up/down and switch gravity off so he doesn't just fall while climbing. When he steps off the ladder, gravity comes back on.

Remember the map geometry from Milestone 1: the girder has a hole where the ladder passes through it, and the ladder sticks up one tile above that hole. So the climb goes: overlap the ladder at the bottom → gravity off → rise through the hole → arrive on the tile above the floor, still overlapping the ladder so you don't drop back down → press left or right to step onto solid girder → gravity comes back on.

Milestone 5 — Rolling barrels

Make Donkey Kong spawn a barrel at the top every couple of seconds (Technique 9). A barrel is a body (so gravity makes it fall off ledges) that also moves sideways.

Notice that your ladder holes double as barrel chutes — a barrel rolling along a floor will drop through the first hole it meets and land on the floor below. That's free level design; you don't have to code it.

Milestone 6 — Reach the top + title/game-over screens

The G tile in your map is the goal. Give it an area() and the tag "goal"; when the hero touches it → Win scene. Wrap the game in a Title screen (start) and a Game Over screen (shows score, restart).

Milestone 7 (stretch) — Points for jumping barrels

Give the hero points when he successfully jumps over a barrel. Think about how you'd detect that: the hero is in the air (not grounded) and a barrel passes beneath him. Plan the check before you write it.


🌟 Stretch goals (only after it works!)


🧗 A note on the hardest parts

Two things trip everyone up on their first platformer — expect them, and you won't be discouraged:

  1. Falling through floors. Almost always means the floor isn't a static body, or the faller doesn't have an area + body. Re-check Technique 7.
  2. Ladders feel weird. That's normal — climbing is genuinely fiddly because you're fighting gravity. Get running and jumping rock-solid first (Milestones 2–3), then tackle ladders. Keep your first ladder version dead simple.

✅ Donkey Kong planning checklist

Start with Milestone 1. Get the hero falling and landing before anything else — that one win makes the rest click. 🦍