← library
prompt🎮 Gamesv2 · updated 2026-06-12

Browser 2D game

Ship a polished 2D web game with Phaser, TypeScript, and Vite.

Run it as a prompt

Paste this into any AI agent, or fetch it: curl -s https://uplift.page/api/v1/prompts/browser-2d-game/raw

prompt.md
# Browser 2D game

Build a 2D game that loads in under 3 seconds, runs at 60fps on a mid-range laptop, and is playable with keyboard and touch.

## Recommended stack

- **Phaser 3** - game engine. Mature 2D engine with scenes, arcade physics, tweens, and a huge example library.
- **TypeScript** - language. Game state bugs are type bugs; strict mode catches them before playtests.
- **Vite** - build tool. Instant reload keeps the tune-test loop under a second.
- **Vercel or itch.io** - hosting. Static export deploys in one command; itch.io brings players.

## Build steps

1. Scaffold with `npm create vite@latest` (vanilla-ts), add `phaser`.
2. Create three scenes: Boot (asset load), Play, and GameOver - keep scene state in plain objects, not globals.
3. Build one core loop (move, collide, score) before any menus or polish.
4. Add juice last: screen shake, tweened scale on pickups, sound via Phaser's audio.
5. Wire touch controls as a thin layer that emits the same input events as the keyboard.
6. Export static build; test on a phone over LAN before shipping.

## Watch out for

- Physics tunneling at high speeds - clamp velocity or use smaller delta steps.
- Loading all assets up front; stream level art per scene.
- Building menus first - the loop is the game.

## Definition of done

- 60fps with the performance overlay on
- Playable start-to-restart without reloading the page
- Works with keyboard, touch, and no audio context errors on mobile Safari

The full prompt

Build a 2D game that loads in under 3 seconds, runs at 60fps on a mid-range laptop, and is playable with keyboard and touch.

Recommended stack

  • Phaser 3 - game engine. Mature 2D engine with scenes, arcade physics, tweens, and a huge example library.
  • TypeScript - language. Game state bugs are type bugs; strict mode catches them before playtests.
  • Vite - build tool. Instant reload keeps the tune-test loop under a second.
  • Vercel or itch.io - hosting. Static export deploys in one command; itch.io brings players.

Build steps

  1. Scaffold with npm create vite@latest (vanilla-ts), add phaser.
  2. Create three scenes: Boot (asset load), Play, and GameOver - keep scene state in plain objects, not globals.
  3. Build one core loop (move, collide, score) before any menus or polish.
  4. Add juice last: screen shake, tweened scale on pickups, sound via Phaser's audio.
  5. Wire touch controls as a thin layer that emits the same input events as the keyboard.
  6. Export static build; test on a phone over LAN before shipping.

Watch out for

  • Physics tunneling at high speeds - clamp velocity or use smaller delta steps.
  • Loading all assets up front; stream level art per scene.
  • Building menus first - the loop is the game.

Definition of done

  • 60fps with the performance overlay on
  • Playable start-to-restart without reloading the page
  • Works with keyboard, touch, and no audio context errors on mobile Safari

Served from the uplift.page library and refreshed within 5 minutes of every update.