scenes

Guidance for organizing a Phaser 4 game into Scenes, which are separate parts such as a title screen, level, pause screen, or menu. It explains each Scene's setup stages and how Scenes work together.

In plain words
What is it for?
Use it to load assets, initialize game data, update gameplay, switch between screens, run scenes in parallel, and pass data between scenes.
Why use it?
It helps manage what loads, runs, pauses, sleeps, restarts, or appears at the same time as the game changes state.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/phaserjs/phaser/scenes
Any agent
npx skills add phaserjs/phaser --skill scenes
Clone the repo
git clone --depth 1 https://github.com/phaserjs/phaser

Made for: Claude Code, Codex.

Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,675 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00061 $0.04675
Opus 5 $0.00030 $0.02337
Sonnet 5 $0.00012 $0.00935
Haiku 4.5 $0.00006 $0.00468

Measured yesterday against content hash 31a07e16634d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

scenes scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/scenes/SKILL.md · 451 lines

How it starts

The opening of the file, as written. The whole thing — 451 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Scenes

Scenes are the organizational backbone of a Phaser game. Each Scene has its own lifecycle (init, preload, create, update), its own set of injected systems (this.add, this.input, this.cameras, etc.), and can be started, stopped, paused, slept, or run in parallel with other Scenes. The ScenePlugin (this.scene) controls all multi-scene orchestration.

Key source paths: src/scene/Scene.js, src/scene/Systems.js, src/scene/SceneManager.js, src/scene/ScenePlugin.js, src/scene/Settings.js, src/scene/const.js, src/scene/events/, src/scene/InjectionMap.js Related skills: ../game-setup-and-config/SKILL.md, ../loading-assets/SKILL.md, ../events-system/SKILL.md

Quick Start

// Minimal scene with all lifecycle methods
class GameScene extends Phaser.Scene {
    constructor() {
        super('GameScene');
    }

    init(data) {
        // Called first. Receives data passed from other scenes.
        // 'data' is whatever was passed via scene.start('GameScene', { level: 1 })
        this.level = data.level || 1;
    }

    preload() {
        // Called after init. Load assets here.
        this.load.image('logo', 'assets/logo.png');
    }

    create(data) {
        // Called after preload completes. Set up game objects.
        // 'data' is the same object passed to init.
        this.add.image(400, 300, 'logo');
    }

    update(time, delta) {
        // Called every frame while scene is RUNNING.
        // time: current time (ms), delta: ms since last frame (smoothed)
    }
}

const config = {
    width: 800,
    height: 600,
    scene: [GameScene]
};

const game = new Phaser.Game(config);

Core Concepts

Scene Lifecycle

The lifecycle is driven by SceneManager.bootScene() and SceneManager.create():

  1. PENDING (0) - Scene is registered but not yet started.
  2. INIT (1) - scene.init(data) is called if defined. Data comes from settings.data.
  3. START (2) - Systems.start() fires. Events start and ready are emitted.
  4. LOADING (3) - scene.preload() is called if defined. Loader runs. On completion, proceeds to create.
  5. CREATING (4) - scene.create(data) is called if defined. Same data as init.
  6. RUNNING (5) - scene.update(time, delta) called every frame. Scene renders.
  7. PAUSED (6) - No update, but still renders.
  8. SLEEPING (7) - No update, no render. State preserved in memory.
  9. SHUTDOWN (8) - Scene is shut down, systems emit shutdown. Can be restarted.
  10. DESTROYED (9) - Scene is fully destroyed. Cannot be restarted.

Read the full file on GitHub · 451 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 451 lines · 61 tokens per session scan A 31a07e16634d

Subscribe to this mod's changes

scenes is a skill published in the GitHub repository phaserjs/phaser (40,232 stars, last pushed 11d ago), licensed MIT. It adds 61 tokens to every session and 4,675 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

task-manager

Capture actionable user requests as persistent tasks, update task status as work progresses, and keep a shared task store in sync. Use when a user asks an agent to do work, check progress, block a task, complete a task, or manage the Kanban board.

iamlukethedev/Claw3D · 56 tokens

soundclaw

Control Spotify playback, search music, and return shareable music links.

iamlukethedev/Claw3D · 18 tokens

todo

Maintain a shared workspace TODO list with blocked tasks.

iamlukethedev/Claw3D · 12 tokens

onejs-setup-and-overview

Use this skill whenever the user wants to build or set up user interface in a Unity project using OneJS, React, TypeScript, or JSX, e.g. 'add a main menu to my game', 'build a settings screen', 'make a HUD', 'set up OneJS', 'my OneJS panel is blank', 'the UI is not hot reloading'. Covers confirming OneJS is installed…

Singtaa/OneJS · 199 tokens

task-manager

Capture actionable user requests as persistent tasks, update task status as work progresses, and keep a shared task store in sync. Use when a user asks an agent to do work, check progress, block a task, complete a task, or manage the Kanban board.

iamlukethedev/Hermes3D · 56 tokens

photo-sphere-viewer

Use when displaying 360-degree panoramic images (equirectangular/cubemap/dual-fisheye) in web applications, building virtual tours with markers and transitions, embedding interactive panoramas in Vue/React/vanilla JS, or creating 360-degree video players with gyroscope VR support. Photo-Sphere-Viewer v5: JavaScript…

znlgis/opengis-skills · 99 tokens