How to make a 2D game
To make a 2D game, start from a platformer that already runs, change its look, its level and its text, then build one HTML file and play a full round. This guide changes three files and ends with Moonlit Ridge, which you can play below.
Arrow keys or A and D run, Space or W jumps. On a phone, use the buttons at the bottom.
Play in a full tabDownload gameNotices- 3.8 min
- from the prompt to a passing playtest
- 31 of 31
- playtest checks passed
- 262 KB
- one HTML file, no image files
- 3 files
- edited: config, level and game text
1. Copy a working 2D game
You copy a platformer that already plays. The kit's platformer-2d starter is Sparkwright: a small brass robot crossing a dusk ridge that is 116 tiles wide, with 23 sunseeds to gather, 6 bramblebugs to stomp, 4 lanterns that save your place and a beacon to wake at the end. Three hits or falls lose the round.
The starter runs on the LittleJS game engine and draws every sprite and backdrop in code, so the build is one HTML file with no pictures to hunt for. Start from the copy, never from the starter itself, so you can always compare against what you began with. Anthropic's quickstart covers installing Claude Code and opening a folder.
npm run new -- moonlit-ridge --from=starters/platformer-2d
npm run build -- --game=games/moonlit-ridgeThe copy lands in games/moonlit-ridge/, and you edit only src/game/. The unedited starter builds to about 262 KB. The first build tells you the toolchain works before you change a line.
2. Ask for four changes in one prompt
You name what stays and what changes. The prompt keeps the movement and controls, so the jump you tested stays the jump you ship. It changes the palette, the length of the level and the title text, and it ends with the two commands that prove the result: build, then playtest.
We gave this exact prompt to Claude Code on 21 November 2026 and timed it with the kit's own receipt command. The stamps are in the receipts file: setup at 18:36:06 UTC, first play at 18:38:50 and a passing playtest at 18:39:56. That is 3.8 minutes. It leaves out the few minutes spent reading the starter's README and level file first, and Claude usage was not priced.
Use the platformer-2d starter to make a short night-time platformer called Moonlit Ridge. Keep the movement and controls. Change the palette to a cool moonlit night, shorten the level to 72 tiles that end at the beacon, and rename the title and tagline. Build it, run the playtest, and fix anything that fails.Keep the clause fix anything that fails
. The playtest is the part that catches a level the robot cannot finish, and the instruction lets the agent repair it before it hands the game back.
3. Change the look in one file
You change colors in src/game/config.js. Every color the game paints comes from one palette object, so a new time of day is a list of new values. The dusk starter becomes a moonlit night with 24 replaced colors. These six do most of the work:
| What it paints | Name in the file | Dusk starter | Moonlit Ridge |
|---|---|---|---|
| Sky at the top | skyTop | #16123a | #0a0f2e |
| Sky at the horizon | horizon | #ffb070 | #a5d4ee |
| Sun, now the moon | sun | #ffd9a0 | #eaf5ff |
| Moss on the ground | moss | #6e9440 | #3f9d86 |
| Soil | soilTop | #4e2f56 | #27405e |
| Sunseeds | seed | #ffcc4a | #fff0a8 |
Keep the contrast between the ground and the sky. Pale moss on dark soil, and a pale horizon behind dark hills, keeps the platforms readable on a phone in sunlight. Change the title in game.js and the page title in index.html in the same pass, so the tab and the title screen agree.
4. Shorten the level and keep it finishable
You edit the level as lists of pieces in src/game/level.js. Ground is [fromX, toX, top], brambles are a start and an end, and sunseeds and bugs are positions. To end the level early, cut the ground after tile 71, drop the pieces that sat beyond it and move the beacon to [69.5, 6]. Seeds go from 23 to 17, bugs from 6 to 4 and lanterns from 4 to 2.
The starter leaves two rules in a comment: a pit is at most 3 tiles wide and a step up at most 2 tiles. Break them and its bot cannot cross, which fails the playtest. The jump rise the playtest measured was 3.38 tiles with the button held, so a 3-tile pit leaves a margin. For a deeper treatment of tile maps, MDN's tilemap techniques cover the same idea in plain JavaScript.
5. Build, then play a whole round
You run the playtest and read its list. The kit's playtest opens the built file in a browser, presses the real keys, taps the touch buttons and lets the starter's bot play a full round. It passed 31 of 31 checks on this build: both arrow keys, A and D, four jump keys, the touch buttons, a win, a loss, a restart after each, a sandboxed frame and a file opened with no server.
The bot won a full round in 11.8 seconds of real time, and the jump test measured a rise of 3.38 tiles with the button held. Those numbers show the rules work. They do not prove it is fun: play it yourself above, then read the full playtest report.
npm run build -- --game=games/moonlit-ridge
npm run playtest -- --game=games/moonlit-ridgeThe output is dist/index.html, 261,571 bytes with a no-index tag and its notices added for this page. The kit's run record holds the file's hash, the stamps and the playtest summary.
6. Tune how it feels, one number at a time
You change one movement number at a time. The feel of a platformer sits in the six values below, all still at the starter's settings in this copy. Change one, play the first gap, then keep it or put it back.
| Value | Starter setting | What it does |
|---|---|---|
runSpeed | 0.13 | 7.8 tiles a second at 60 updates a second |
jumpSpeed | 0.205 | the upward speed on the first update of a jump |
jumpHoldBoost | 0.0105 | extra lift while the button is held, for 0.16 seconds |
gravity | -0.012 | pulls down every update; falling adds 25% more |
coyoteTime | 0.1 | a jump still works for 0.1 seconds after running off a ledge |
jumpBuffer | 0.15 | a jump pressed up to 0.15 seconds early fires on landing |
Coyote time and the jump buffer are the two that players feel without knowing their names. They forgive a press that is a few frames late. Raise jumpSpeed and every jump carries farther, which changes which pits are fair, so re-run the playtest after any change that moves a jump. When the round plays well, the kit is $29 a year on the pricing page, with Claude access billed separately, and the AI walkthrough shows a larger game with its prompt and bill.
Questions
How do I make a 2D game?
Start from a platformer or puzzle that already runs, change one thing at a time and play after each change. This guide changes the colors, the level length and the title of a kit platformer, builds it into one HTML file and plays a full round, so every edit is checked.
What is the easiest 2D game to make?
A one-screen or short side-scrolling platformer is a good first project: movement, a jump, a few hazards and a goal. Moonlit Ridge has one level of 72 tiles, 17 pickups and 4 enemies, and its rules fit in a few sentences.
What do I need to make a 2D game?
You need a game engine or library, a way to draw, input and a build step. The kit's platformer-2d starter bundles the LittleJS engine and draws everything in code, so a browser, Claude Code and the kit are enough. There are no image files to find.
How long does it take to make a 2D game?
Changing a working starter took 3.8 minutes of Claude Code, from the prompt to a passing playtest, on 21 November 2026. A new game takes longer: the kit's Cold Chain, a larger 3D game, took 50.6 minutes for its first build.

