AI Game Dev
Home › Tutorials › Your first game with Claude Code, part 1

A tiny platformer with a double jump, in three prompts

We asked Claude Code for a browser platformer, then a double jump. It measured its own jumps, and fixed the one we said felt too strong. Play the result.

Tested with Phaser 3.80.1 · Claude Code 2.1.311

This is the real result. Click it and play. Open full screen

What we asked“Add a double jump. Keep the numbers easy to tune, and check it works.”

What happened

You
Make a tiny platformer that runs in the browser with Phaser: a player square that runs and jumps between a few platforms. Keep it to a single page I can open.
  • Used the game-feel skill
  • Wrote index.html
  • Ran the game: no errors
  • Took a screenshot
Claude
Renders cleanly. Let me confirm the jump actually lifts the player by sampling height during a held jump.
  • Measured a held jump and a tapped jump
  • Raised the jump strength
  • Ran the game again: no errors
Claude
I've made the game as a single page. You play a yellow square that runs and jumps across four platforms above the ground. Every tuning value is a named constant at the top of the script. I changed one after testing: JUMP_VELOCITY from 560 to 600. At 560, a full jump reached about 107px. The first platform is 98px above the ground, which left very little margin.
You
Add a double jump. Keep the numbers easy to tune, and check it works.
  • Edited index.html
  • Measured single, double and triple jumps
  • Ran the game: no errors
  • Took a screenshot
Claude
I added the double jump, and it works in the headless browser with no console errors. New constants: AIR_JUMPS = 1, how many extra jumps you get in mid-air, and AIR_JUMP_VELOCITY = 520, a bit below the ground jump (600). Three presses in a row gave no third jump, so the cap works, and you get your air jump back each time you land.
You
I played it. The second jump feels too strong: from the ground I can double jump right past the first platform and land on the second one. Can you make it weaker so the first platform still matters?
Claude
Let me measure the current double-jump height properly, comparing it with how high each platform sits, before I pick a new number.
  • Tried the second press at many timings: best 215px
  • Lowered AIR_JUMP_VELOCITY
  • Tried to skip the first platform 18 ways
  • Took a screenshot
Claude
I weakened the double jump, and you can no longer skip the first platform. The only number I changed is AIR_JUMP_VELOCITY, from 520 to 320. The old value of 520 landed on the second platform 18 out of 18 times, and 320 landed 0 out of 18. My first version of this test was broken: it failed to land even at 520 because the player hit their head on the platform. I fixed it before trusting these numbers. If it feels too weak, you can go up to about 340 before skipping becomes possible again.

We started with an empty folder and one small skill file, then asked Claude Code for a platformer in plain words. It wrote the whole game as one web page, opened it in a hidden browser, took a screenshot, and measured how high the square could jump. The jump was barely high enough to reach the first platform, so it made the jump a little stronger on its own and told us which number it changed.

The double jump took one more sentence. Claude added two numbers at the top of the file: how many extra jumps you get, and how strong they are. Then it tested a single jump, a double jump and a triple jump, to check that the third press did nothing. When we played it ourselves, the second jump was too strong. From the ground you could jump straight past the first platform onto the second one.

We recorded one of Claude's skip-test jumps in the real game, shown at half speed. It starts on the ground beside the second platform, and the second press comes at 0.4 seconds. Only the second-jump strength changes. Heights and the 18 tries are from Claude's own tests.

We told Claude exactly that. It worked out the highest a double jump could go, lowered the second jump from 520 to 320, and tried to skip the first platform 18 different ways. It also admitted that its first version of that test was broken. The square hit its head on the platform and never landed, even with the old, too-strong number, so it fixed the test before trusting it. For this page we made one change of our own: we added a “click to play” screen and loaded Phaser from the site instead of the internet. The game itself is exactly what Claude wrote.

The skill that made it work

It makes Claude open the game and look at it after every change, instead of only writing code, and tell you which numbers it changed.

game-feel
  1. Keep every tuning number (speed, gravity, jump strength, and so on) as a named constant at the top of the game file.
  2. After each change, open the game in a headless browser with Playwright (installed globally; `require('playwright')` works) and take a screenshot to check it runs without console errors.
  3. Tell me which numbers you changed and why.

Save it as .claude/skills/game-feel/SKILL.md in your project.