events-system

Implements event-driven communication using Phaser 4 EventEmitter, scene events, and named constants.

Updated Jul 13, 2026
One-click install
npx skills add https://github.com/russellmorgan/UnderConstruction --skill events-system-russellmorgan
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: events-system
Source: https://github.com/russellmorgan/UnderConstruction/tree/main/.claude/skills/events-system
Command: npx skills add https://github.com/russellmorgan/UnderConstruction --skill events-system-russellmorgan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Phaser 4 games rely on the EventEmitter pattern across every major system, and developers often struggle with typos in event strings, memory leaks from unremoved listeners, and confusion between scene-level and game-level emitters. This Skill provides the complete event API, all event namespaces, and safe listener management patterns. ## Core Features & Use Cases - Full EventEmitter API Reference: Covers on, once, off, emit, removeAllListeners, and context binding inherited from eventemitter3. - Complete Event Namespace Tables: Documents every built-in event constant and string for scenes, game, input, loader, animations, cameras, sound, tweens, physics, textures, GameObjects, and timers. - Inter-Scene Communication Patterns: Shows three methods for cross-scene messaging using game.events, the registry DataManager, and direct scene access. - Use Case: When building a Phaser game where the UI scene must react to score changes in the gameplay scene, use this Skill to wire up game.events listeners correctly and clean them up on scene shutdown to prevent duplicate-handler bugs on restart. ## Quick Start Ask the AI to show how to listen for a pointer down event in a Phaser scene and clean up the listener when the scene shuts down.

Frequently Asked Questions about events-system

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

FAQPage Schema
How do I listen for events in Phaser 4?▼

Use the on method on any Phaser emitter, such as this.input.on('pointerdown', handler) or this.events.on(Phaser.Scenes.Events.UPDATE, handler, this). Prefer named constants over raw strings to avoid typos and enable IDE autocomplete.

How to communicate between scenes in Phaser?▼

Phaser offers three inter-scene communication methods: emit custom events on this.game.events as a global bus, use this.registry DataManager with changedata events, or call this.scene.get('SceneKey').events.emit directly on another scene.

Why do Phaser event listeners fire multiple times after scene restart?▼

Listeners registered with on() persist across scene restarts because shutdown does not auto-remove them, so each restart adds duplicates. Fix this by removing listeners in a SHUTDOWN handler using off() with the same function reference and context.

What is the difference between this.events and this.game.events in Phaser?▼

this.events is the scene-specific emitter firing scene lifecycle events and is cleaned up on scene destroy. this.game.events is a global emitter shared across all scenes that persists through restarts, so its listeners must be removed manually on shutdown.

Can I remove an anonymous arrow function listener in Phaser?▼

No, off() requires the exact same function reference and context passed to on(), so inline arrow functions cannot be removed. Store the handler in a variable or use a named class method, or use once() for one-time listeners that auto-remove.