phaser▌
opusgamelabs/game-creator · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
You are an expert Phaser game developer building games with the game-creator plugin. Follow these patterns to produce well-structured, visually polished, and maintainable 2D browser games.
Phaser 3 Game Development
You are an expert Phaser game developer building games with the game-creator plugin. Follow these patterns to produce well-structured, visually polished, and maintainable 2D browser games.
Core Principles
- Core loop first — Implement the minimum gameplay loop before any polish: boot → preload → create → update. Add the win/lose condition and scoring before visuals, audio, or juice. Keep initial scope small: 1 scene, 1 mechanic, 1 fail condition. Wire spectacle EventBus hooks (
SPECTACLE_*events) alongside the core loop — they are part of scaffolding, not deferred polish. - TypeScript-first — Always use TypeScript for type safety and IDE support
- Scene-based architecture — Each game screen is a Scene; keep them focused
- Vite bundling — Use the official
phaserjs/template-vite-tstemplate - Composition over inheritance — Prefer composing behaviors over deep class hierarchies
- Data-driven design — Define levels, enemies, and configs in JSON/data files
- Event-driven communication — All cross-scene/system communication via EventBus
- Restart-safe — Gameplay must be fully restart-safe and deterministic.
GameState.reset()must restore a clean slate. No stale references, lingering timers, or leaked event listeners across restarts.
Spectacle Events
Every player action and game event must emit at least one spectacle event. These hooks exist in the template EventBus — the design pass attaches visual effects to them.
| Event | Constant | When to Emit |
|---|---|---|
spectacle:entrance |
SPECTACLE_ENTRANCE |
In create() when the player/entities first appear on screen |
spectacle:action |
SPECTACLE_ACTION |
On every player input (tap, jump, shoot, swipe) |
spectacle:hit |
SPECTACLE_HIT |
When player hits/destroys an enemy, collects an item, or scores |
spectacle:combo |
SPECTACLE_COMBO |
When consecutive hits/scores happen without a miss. Pass { combo: n } |
spectacle:streak |
SPECTACLE_STREAK |
When combo reaches milestones (5, 10, 25, 50). Pass { streak: n } |
spectacle:near_miss |
SPECTACLE_NEAR_MISS |
When player narrowly avoids danger (within ~20% of collision radius) |
Rule: If a gameplay moment has no spectacle event, add one. The design pass cannot polish what it cannot hook into.
Mandatory Conventions
All games MUST follow the game-creator conventions:
core/directory with EventBus, GameState, and Constants- EventBus singleton —
domain:actionevent naming, no direct scene references - GameState singleton — Centralized state with
reset()for clean restarts - Constants file — Every magic number, color, speed, and config value — zero hardcoded values
- Scene cleanup — Remove EventBus listeners in
shutdown()
See conventions.md for full details and code examples.
Project Setup
Use the official Vite + TypeScript template as your starting point:
npx degit phaserjs/template-vite-ts my-game
cd my-game && npm install
Required Directory Structure
src/
├── core/
│ ├── EventBus.ts # Singleton event bus + event constants
│ ├── GameState.ts # Centralized state with reset()
│ └── Constants.ts # ALL config values
├── scenes/
│ ├── Boot.ts # Minimal setup, start Game scene
│ ├── Preloader.ts # Load all assets, show progress bar
│ ├── Game.ts # Main gameplay (starts immediately, no title screen)
│ └── GameOver.ts # End screen with restart
├── objects/ # Game entities (Player, Enemy, etc.)
├── systems/ # Managers and subsystems
├── ui/ # UI components (buttons, bars, dialogs)
├── audio/ # Audio manager, music, SFX
├── config.ts # Phaser.Types.Core.GameConfig
└── main.ts # Entry point
See project-setup.md for full config and tooling details.
Scene Architecture
- Lifecycle:
init()→preload()→create()→update(time, delta) - Use
init()for receiving data from scene transitions - Load assets in a dedicated
Preloaderscene, not in every scene - Keep
update()lean — delegate to subsystems and game objects - No title screen by default — boot directly into gameplay. Only add a title/menu scene if the user explicitly asks for one
- No in-game score HUD — the Play.fun widget displays score in a deadzone at the top of the game. Do not create a separate UIScene or HUD overlay for score display
- Use parallel scenes for UI overlays (pause menu) only when requested
Play.fun Safe Zone
When games run inside the Play.fun dashboard on mobile Safari, the SDK sets CSS custom properties on the game iframe's document.documentElement:
--ogp-safe-top-inset— space below the Play.fun header bubbles (~68px on mobile)--ogp-safe-bottom-inset— space above Safari bottom controls (~148px on mobile)
Both default to 0px when not running inside the dashboard (desktop, standalone).
The template's Constants.js reads these at boot and exposes SAFE_ZONE.TOP and SAFE_ZONE.BOTTOM in canvas pixels (CSS value × DPR). A static fallback (GAME.HEIGHT * 0.08) ensures the top safe zone works even without the SDK.
Rules:
- All UI text, buttons, and HUD elements must be positioned below
SAFE_ZONE.TOPand aboveGAME.HEIGHT - SAFE_ZONE.BOTTOM - Gameplay entities should not spawn in the safe zone areas
- The game-over screen, score panels, and restart buttons must offset from both
SAFE_ZONE.TOPandSAFE_ZONE.BOTTOM - Use
const usableH = GAME.HEIGHT - SAFE_ZONE.TOP - SAFE_ZONE.BOTTOMfor calculating proportional positions in UI scenes - Game canvas and backgrounds should fill the full viewport (bleed behind browser chrome)
- Touch controls at the bottom must account for
SAFE_ZONE.BOTTOM
import { SAFE_ZONE } from '../core/Constants.js';
// In any UI scene:
const safeTop = SAFE_ZONE.TOP;
const safeBottom = SAFE_ZONE.BOTTOM;
const usableH = GAME.HEIGHT - safeTop - safeBottom;
const title = this.add.text(cx, safeTop + usableH * 0.15, 'GAME OVER', { ... });
const button = createButton(scene, cx, safeTop + usableH * 0.6, 'PLAY AGAIN', callback);
// Touch controls / bottom HUD:
const bottomY = GAME.HEIGHT - safeBottom - 40 * PX;
How it works in Constants.js:
function _readSafeInsets() {
const s = getComputedStyle(document.documentElement);
const top = parseInt(s.getPropertyValue('--ogp-safe-top-inset')) || 0;
const bottom = parseInt(s.getPropertyValue('--ogp-safe-bottom-inset')) || 0;
return { top: top * DPR, bottom: bottom * DPR };
}
const _insets = _readSafeInsets();
export const SAFE_ZONE = {
TOP: Math.max(GAME.HEIGHT * 0.08, _insets.top),
BOTTOM: _insets.bottom,
LEFT: 0,
RIGHT: 0,
};
- Communicate between scenes via EventBus (not direct references)
See scenes-and-lifecycle.md for patterns and examples.
Game Objects
- Extend
Phaser.GameObjects.Sprite(or other base classes) for custom objects - Use
Phaser.GameObjects.Groupfor object pooling (bullets, coins, enemies) - Use
Phaser.GameObjects.Containerfor composite objects, but avoid deep nesting - Register custom objects with
GameObjectFactoryfor scene-level access
See game-objects.md for implementation patterns.
Physics
- Arcade Physics — Use for simple games (platformers, top-down). Fast and lightweight.
- Matter.js — Use when you need realistic collisions, constraints, or complex shapes.
- Never mix physics engines in the same game.
- Use the state pattern for character movement (idle, walk, jump, attack).
See physics-and-movement.md for details.
Performance (Critical Rules)
- Use texture atlases — Pack sprites into atlases, never load individual images at scale
- Object pooling — Use Groups with
maxSize; recycle withsetActive(false)/setVisible(false) - Minimize update work — Only iterate active objects; use
getChildren().filter(c => c.active) - Camera culling — Enable for large worlds; off-screen objects skip rendering
- Batch rendering — Fewer unique textures per frame = better draw call batching
- Mobile — Reduce particle counts, simplify physics, consider 30fps target
pixelArt: true— Enable in game config for pixel art games (nearest-neighbor scaling)
See assets-and-performance.md for full optimization guide.
Advanced Patterns
- ECS with bitECS — Entity Component System for data-oriented design (used internally by Phaser 4)
- State machines — Manage entity behavior states cleanly
- Singleton managers — Cross-scene services (audio, save data, analytics)
- Event bus — Decouple systems with a shared EventEmitter
- Tiled integration — Use Tiled map editor for level design
See patterns.md for implementations.
Mobile Input Strategy (60/40 Rule)
All games MUST work on desktop AND mobile unless explicitly specified otherwise. Focus 60% mobile / 40% desktop for tradeoffs. Pick the best mobile input for each game concept:
| Game Type | Primary Mobile Input | Desktop Input |
|---|---|---|
| Platformer | Tap left/right half + tap-to-jump | Arrow keys / WASD |
| Runner/endless | Tap / swipe up to jump | Space / Up arrow |
| Puzzle/match | Tap targets (44px min) | Click |
| Shooter | Virtual joystick + tap-to-fire | Mouse + WASD |
| Top-down | Virtual joystick | Arrow keys / WASD |
Implementation Pattern
Abstract input into an inputState object so game logic is source-agnostic:
// In Scene update():
const isMobile = this.sys.game.device.os.android ||
this.sys.game.device.os.iOS || this.sys.game.device.os.iPad;
let left = false, right = false, jump = false;
// Keyboard
left = this.cursors.left.isDown || this.wasd.left.isDown;
right = this.cursors.right.isDown || this.wasd.right.isDown;
jump = PhaserHow to use phaser on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add phaser
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches phaser from GitHub repository opusgamelabs/game-creator and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate phaser. Access the skill through slash commands (e.g., /phaser) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
User Story & Requirements Generation
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
Reduce spec writing time by 50%, ensure comprehensive coverage
Competitive Analysis
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
Complete competitive research in 2 hours instead of 2 days
Roadmap Prioritization
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
Make data-driven prioritization decisions faster
Stakeholder Communication
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
Save 3-5 hours/week on communication overhead
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client
- ›Access to product documentation and roadmap tools (Jira, Notion, etc.)
- ›Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
- ›Stakeholder contact information and communication channels
Time Estimate
30-60 minutes to see productivity improvements
Installation Steps
- 1.Install product management skill
- 2.Start with user story generation for known feature
- 3.Progress to competitive analysis: research 2-3 competitors
- 4.Use for roadmap prioritization: apply RICE/ICE scoring
- 5.Draft stakeholder communications and refine based on feedback
- 6.Build template library for recurring PM tasks
- 7.Share effective prompts with product team
Common Pitfalls
- ⚠Not validating competitive research—verify facts before sharing
- ⚠Accepting user stories without involving engineering team
- ⚠Over-relying on frameworks without qualitative judgment
- ⚠Not customizing outputs to company culture and communication style
- ⚠Skipping stakeholder validation of generated requirements
Best Practices▌
✓ Do
- +Validate research and competitive analysis with real data
- +Collaborate with engineering when generating technical requirements
- +Customize frameworks and templates to your company context
- +Use skill for first drafts, refine with stakeholder input
- +Document successful prompt patterns for PM tasks
- +Combine AI efficiency with human judgment and intuition
✗ Don't
- −Don't publish competitive analysis without fact-checking
- −Don't finalize user stories without engineering review
- −Don't make prioritization decisions solely on AI scoring
- −Don't skip customer validation of generated requirements
- −Don't ignore company-specific context and culture
💡 Pro Tips
- ★Provide context: company goals, constraints, customer feedback
- ★Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
- ★Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
- ★Use skill for 70% generation + 30% customization to company needs
When to Use This▌
✓ Use When
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid When
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
Learning Path▌
- 1Basic: user stories, feature specs, status updates
- 2Intermediate: competitive analysis, prioritization frameworks, PRDs
- 3Advanced: product strategy, go-to-market planning, OKR setting
- 4Expert: product vision, market positioning, business model innovation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.6★★★★★62 reviews- ★★★★★James Verma· Dec 24, 2024
phaser reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Valentina Shah· Dec 16, 2024
phaser has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Nikhil Chawla· Dec 12, 2024
Registry listing for phaser matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Zaid Yang· Dec 8, 2024
phaser fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Jin Ndlovu· Dec 4, 2024
We added phaser from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Carlos Okafor· Nov 27, 2024
phaser is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Luis Khanna· Nov 23, 2024
Keeps context tight: phaser is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Rahul Santra· Nov 19, 2024
Registry listing for phaser matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Neel Okafor· Nov 19, 2024
phaser reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Nia Martinez· Nov 7, 2024
Useful defaults in phaser — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
showing 1-10 of 62