Home › Phaser (web games) › Phaser 3 browser game rules
Phaser 3 browser game rules
Windsurf rules for 2D browser games with Phaser 3, TypeScript and Vite.
WindsurfPhaser (web games)
How to use
Save this as .windsurf/rules/phaser.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.
.windsurf/rules/phaser.mdDownload # Windsurf rules — Phaser 3 + TypeScript
- Phaser 3, TypeScript, Vite. One class per Scene in `src/scenes/` (Boot, Preload, Menu, Game, UI).
- Load all assets in `PreloadScene`; reference them by constant keys from `src/assets/keys.ts`.
- Game objects extend Phaser classes in `src/objects/`. Keep game rules out of scenes when they grow beyond ~200 lines.
- Use Arcade Physics unless the design needs Matter. Use groups + `setActive/setVisible` pooling for bullets and particles.
- Frame-rate independent movement: multiply by `delta / 1000` in `update`.
- UI runs in a separate parallel scene, communicating via `this.events`/the registry.
- Run `pnpm dev` and describe what to test manually; run `pnpm build` before finishing.