Skip to content
Back to skills

Phaser Development

ASecurity

Phaser 3 TypeScript game development patterns including scene architecture, arcade physics, texture generation, config-driven design, and coding conventions. Use when implementing or modifying a Phaser 2D game.

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added August 30, 2026
ai-agentstypescriptgoshellperformance

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned August 30, 2026

npx -y skills add robcost/gameforge --skill phaser-development --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Phaser Development?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Phaser Development
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/robcost-phaser-development/badge)](https://www.skillsdirectory.com/skills/robcost-phaser-development)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: phaser-development
description: Phaser 3 TypeScript game development patterns including scene architecture, arcade physics, texture generation, config-driven design, and coding conventions. Use when implementing or modifying a Phaser 2D game.
---

# Phaser 3 Game Development Patterns

## Project Structure

The Phaser game project uses Vite + TypeScript with this layout:

```
src/
  config.ts        - All game constants (VIEWPORT, CONTROLS, plus everything from GDD)
  main.ts          - DOM entry point, calls startGame()
  scenes/
    BootScene.ts   - Has generateTexture() helper, preload() for texture/asset setup
    MainScene.ts   - Empty scene shell with reset key - all gameplay goes here
```

## Config-Driven Design

- **All game constants** (dimensions, speeds, colors, physics values) go in `src/config.ts`
- Scenes import from config - never hardcode values in scene files
- When the GDD specifies values, add them to config.ts
- Read the GDD's `controls` field to know what keys to wire up

## Scene Architecture

- Every scene extends `Phaser.Scene` with a unique `key` string
- `BootScene` handles texture generation via its `generateTexture(key, width, height, color)` method
- Add texture generation calls in BootScene's `preload()` method - one per visual entity
- `MainScene` (or level-specific scenes) handle gameplay logic
- Register new scenes in `BootScene.ts`'s `startGame()` function

## Textures (Procedural Generation)

- Default visuals are colored rectangles generated programmatically via `generateTexture()`
- Colors in Phaser use hex numbers: `0x4fc3f7` (not CSS strings)
- GDD colors are CSS hex strings: `'#4fc3f7'` - convert by replacing `#` with `0x`
- Each entity needs one `generateTexture()` call in BootScene's `preload()`

## Physics (Arcade)

- The template starts with gravity=0 and arcade physics enabled
- **Set gravity in startGame()** or in the scene based on the GDD (e.g. gravity.y=600 for platformers, 0 for shooters)
- `this.physics.add.staticGroup()` for immovable objects (platforms, walls, barriers)
- `this.physics.add.sprite()` for the player and dynamic entities
- `this.physics.add.group()` for enemies, collectibles, projectiles
- Set world bounds for levels wider/taller than viewport: `this.physics.world.setBounds()`
- Collision: `this.physics.add.collider(player, platforms)` for solid collision
- Overlap: `this.physics.add.overlap(player, coins, collectCallback)` for trigger-style

## HUD

- Use `this.add.text()` with `.setScrollFactor(0)` for fixed UI elements
- Score, lives, health, timer - only render what the GDD enables
- Position HUD elements relative to the camera viewport, not world coordinates

## Mandatory Controls

- **Every game MUST include a reset key**: The template already has this wired (R key)
- Do NOT remove or modify the existing reset key handler in MainScene
- Add a small HUD text in the top-right corner: `"Press R to restart"` - the template already has this

## Genre Patterns

For genre-specific implementation patterns (platformer, shooter, top-down, arcade, puzzle), see [GENRES.md](GENRES.md).

## Asset Loading and Audio

For image asset loading, sprite display sizing, platform rendering, and background music integration, see [ASSETS.md](ASSETS.md).

## Performance Optimization

For object pooling, BitmapText, GC avoidance, camera culling, and render pipeline tips, see [PERFORMANCE.md](PERFORMANCE.md).

## Animation and Game Feel

For sprite animation, tween chaining, game juice effects, and easing functions, see [ANIMATION.md](ANIMATION.md).

## Common Pitfalls

For the most common Phaser 3 bugs and how to avoid them, see [PITFALLS.md](PITFALLS.md).

Files in this skill

  • ANIMATION.md3.9 KB
  • ASSETS.md2.9 KB
  • GENRES.md3.9 KB
  • PERFORMANCE.md4.1 KB
  • PITFALLS.md4 KB
  • SKILL.md3.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.