Make a 2D platformer in the browser, drawn entirely in code
Whether a platformer feels good comes down to a handful of numbers in the jump and a few forgiving tricks the player never notices. Anticode can write a 2D platformer as one browser game, drawn on a canvas with no outside sprites, with keyboard and touch controls. Where the review service runs, it's opened and clicked through at phone and laptop widths before you play it.
The jump is the game
Players judge a platformer within seconds of their first jump. A jump that rises and falls at the same speed feels floaty; one with stronger gravity on the way down feels sharp and readable. Most good platformers also let the player control the height: release the button early and the jump is cut short. Those three values, rise speed, fall gravity and the short-hop cut, are worth naming in your request if you have a feel in mind ("tight and snappy, like a precision platformer" or "floaty and forgiving for young children").
Forgiveness the player never sees
- Coyote time
- A few frames after running off a ledge during which a jump still counts. Without it, players swear they pressed jump in time, and they're right.
- Jump buffering
- A jump pressed just before landing is remembered and fires on landing, so a rhythm of jumps feels responsive.
- Corner correction
- If the head clips a ceiling corner by a pixel or two, nudge the player sideways instead of stopping the jump dead.
- Generous hitboxes
- Enemies and spikes hurt with a slightly smaller box than they're drawn; coins collect with a slightly bigger one.
- Checkpoints
- Respawn close to where the player died, especially before a hard section.
Whatever platformer game maker you use, ask for these by name. They're small amounts of code and they're the difference between a game people finish and one they quit on level two.
Levels that teach
A level is easiest to design as a grid of tiles, written as rows of characters in the code: solid ground, one-way platforms, spikes, moving platforms, the goal. That makes changing a level a matter of editing a short map, which is also easy to ask for in words ("make the gap after the second checkpoint one tile wider").
Introduce each new idea safely, then test it, then combine it. A moving platform first appears over solid ground; next over a short gap; then with a spike on the far side. Five to eight short levels that each teach one thing make a better first game than thirty long ones.
Art without image files
Anticode apps can't load sprites, sounds or tilesets from the web. Everything is drawn in code with Canvas 2D: shapes, gradients, simple pixel art defined as small arrays, particle effects for dust and coins. That suits several styles well, such as flat geometric, neon outline or chunky pixel. Sound effects are made with the browser's audio API, so a jump blip or a coin chime needs no file. If you have your own character art, you can add images to the build and the model will use them.
Describing the game to Anticode
Give the character, the world, the mechanics and the length: "A 2D platformer about a lighthouse keeper's cat collecting fish across six levels on a stormy coast. Run, jump with variable height, wall-slide from level 3. Crabs patrol and can be jumped on. Coyote time and jump buffering. Checkpoint flags. Dark blue palette, rain particles." The Architect asks up to three questions where the answer changes the build, such as whether the camera scrolls sideways only or follows vertically too.
The game is written as one HTML document. Ask for a fixed-step game loop, so physics behave the same on a fast laptop and a slow phone. It opens on a title screen with a start button and shows the controls, because keyboard input only reaches the game after someone clicks or taps it. On touch screens it adds on-screen buttons; ask for their layout if you have a preference.
How the build gets checked
The code goes through Anticode's app checks, with one automatic repair pass. When the review service is available, the new build is also opened in headless Chrome at phone and laptop widths, screenshotted and clicked through, and the Critic fixes errors it sees, such as a canvas that doesn't scale or a start screen that never starts. A machine clicking through can't tell you whether level 4 is fun. Play it, then ask for changes in a sentence.
Limits
- No online leaderboards or multiplayer. Best times and unlocked levels save in the player's browser only.
- No level editor for players to share levels. A built-in editor can save levels on that device, but they can't be published to others.
- Scope. A single document of a few thousand lines suits a short, polished game. A large game with dozens of worlds, save slots and a story is a job for a game engine.
For a one-button version see the endless runner; for depth over speed, the puzzle game maker. The browser game maker page covers game genres more broadly.
Questions people ask
Can players use a game controller?
Keyboard and touch are the default. Ask for controller support in the request if you need it, and test it with your own pad.
Can I publish it as a mobile app?
Published sites can be installed from the browser as an app. Anticode also produces an app-store checklist and a Capacitor project; submitting to the stores is up to you.
Does the game work offline?
Once loaded, it runs entirely in the page, so play doesn't depend on a connection. If you install it to a home screen, test opening it offline before you rely on that.