scenes

Organize Phaser 4 Scene lifecycles, transitions, and cross-scene communication.

40.1k|7.2k|Updated Apr 12, 2013
One-click install
npx skills add https://github.com/phaserjs/phaser --skill scenes-phaserjs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: scenes
Source: https://github.com/phaserjs/phaser/tree/main/skills/scenes
Command: npx skills add https://github.com/phaserjs/phaser --skill scenes-phaserjs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Organizes and explains Phaser 4 Scene lifecycles, transitions, parallel scenes, and inter-scene communication to enable clean, scalable game flow.

Core Features & Use Cases

  • Comprehensive coverage of the Scene lifecycle (init, preload, create, update) and the SceneManager orchestration.
  • Support for parallel scenes, sleep/wake, and data sharing across scenes to coordinate complex game states.
  • Detailed guidance on events, transitions, and common patterns to build robust multi-scene architectures.

Quick Start

Create a minimal scene and observe its lifecycle events in your Phaser 4 project.

Frequently Asked Questions about scenes

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does the Phaser scene lifecycle work?

The Phaser scene lifecycle operates through sequential phases: init, preload, create, and update. The SceneManager orchestrates these phases, handling scene instantiation, rendering loops, and system shutdown to establish robust game flow architecture.

How do I share data between parallel Phaser scenes?

You can share data between parallel Phaser scenes using the SceneManager's built-in registry and event systems. This approach supports complex game state coordination by allowing active, sleeping, and waking scenes to transmit and access shared data payloads.

What is the best way to handle scene transitions in game development?

The best way to handle Phaser scene transitions is using the SceneManager's transition API alongside lifecycle events. This enables clean, scalable game flow by applying transition patterns that manage visual fades, data passing, and parallel scene orchestration smoothly.

When should I use sleep and wake states for Phaser scenes?

You should use sleep and wake states in Phaser when running parallel scenes that need to pause rendering without losing their current state. This lifecycle approach preserves scene data and active systems while yielding processing focus to another active scene.

Can I run multiple Phaser scenes at the same time?

Yes, you can run multiple Phaser scenes simultaneously by utilizing parallel scene execution. The SceneManager allows you to coordinate complex game states by keeping several scenes active, sleeping, or transitioning in parallel without destroying their internal data.

Why is my Phaser scene not moving to the next lifecycle phase?

A Phaser scene may stall between phases if the SceneManager events are not properly configured or if asynchronous preload tasks remain unresolved. Checking scene lifecycle constants and event listeners helps identify orchestration bottlenecks blocking the update loop.