▶ CARTRIDGE
Game Prototype Cartridge
A playable Phaser 4 game your AI agent can build on without breaking it.
$29 · one-time
Plus sales tax or VAT where applicable, calculated at checkout.
- One-time payment. No subscription, no account.
- Secure checkout by Stripe, the merchant of record.
- Your download starts on the next page. Bookmark it to re-download anytime.
- Plain files you can read and edit. Questions before you buy? support@agentcartridge.com

A complete, small browser game (top-down arena survival) in Phaser 4 + Vite + TypeScript, set up for AI-assisted game jams: player, two enemy types, waves, combo scoring, pause and game over; pure game logic with unit tests; a headless play test your agent can run; Cursor, Claude Code and AGENTS.md rules that keep agents on the Phaser 4 API and your scene/asset conventions; and an itch.io export script plus guide. One-time purchase (sales tax or VAT added at checkout where applicable), instant download.
Requirements: Needs Node.js 20.19+ and a modern browser. Controls are keyboard + mouse (adding touch controls is one of the included agent prompts). Placeholder shapes, no art files: bring your own art.
What's inside
| File | Covers |
|---|---|
src/scenes/ | Boot → Menu → Game (+ HUD overlay and Pause) → GameOver, with restart-safe state |
src/entities/ | Player, Enemy (chaser + telegraphed dasher) and pooled Bullet classes on Arcade Physics |
src/config/balance.ts | Every gameplay number in one file: speeds, HP, fire rate, waves, combo, drops |
src/logic/ + tests/ | Pure, unit-tested rules: wave planner, spawns, combo, health + i-frames, dasher AI state machine, high score, seeded RNG (17 vitest tests) |
scripts/smoke.mjs | Headless play test: boots the real build in Chromium, plays, pauses, dies, restarts, fails on any error |
scripts/zip-itch.mjs | Builds itch-build.zip and checks itch.io's HTML5 upload rules first |
.cursor/rules/*.mdc | 4 Cursor rules: game workflow (always on), Phaser 4 API (v3 traps to avoid), game logic, scenes + assets |
CLAUDE.md + AGENTS.md | The same rules for Claude Code, Codex, OpenCode and other agents |
docs/ | CONVENTIONS.md (scene, entity and asset conventions), ITCH-EXPORT.md (step-by-step upload guide), AGENT-PLAYBOOK.md (copy-paste prompts: new enemy, power-up, boss, art swap, sound, touch controls) |
README.md + LICENSE.md | Quick start, scripts, and the license: use it in any number of your own games, free or commercial |
Peek inside
.cursor/rules/10-phaser4.mdc · The first lines of one of the 4 Cursor rules.
---
description: Phaser 4 API rules (avoid Phaser 3 APIs that were removed or changed)
globs: src/**/*.ts
alwaysApply: false
---
# Phaser 4 API
Most examples online are Phaser 3. This project is pinned to phaser@4.2.1. Check `node_modules/phaser/types/phaser.d.ts` when unsure.
- Import: `import Phaser from "phaser";` and use `Phaser.Physics.Arcade.Sprite`, `Phaser.Scene`, etc.
- Tint flash: `obj.setTint(0xffffff).setTintMode(Phaser.TintModes.FILL)`; reset `obj.clearTint().setTintMode(Phaser.TintModes.MULTIPLY)`. `setTintFill` does not exist.
- Effects: FX and masks are Filters now. Game objects: call `obj.enableFilters()` first (WebGL only, so guard with `obj.filters?.`), then `obj.filters?.internal.addGlow(...)` / `addBlur` / `addMask`. Cameras: `this.cameras.main.filters.internal|external`. Bloom/Shine are `Phaser.Actions.AddEffectBloom(target)` / `AddEffectShine`. No `preFX`/`postFX`, no `BitmapMask`.
- Math: `Phaser.Math.Vector2` (no `Geom.Point`). `Phaser.Math.TAU === 2π`; quarter turn is `Phaser.Math.PI_OVER_2`. Angles are radians, 0 = facing +x (right); placeholder art faces right.
- Data structures: native `Set`/`Map` (no `Phaser.Struct.Set/Map`).
…Stripe emails your receipt. Lost your download link? Email us with the receipt and we'll sort it out. Questions: support@agentcartridge.com