What problem does it solve?
Managing Phaser’s event-driven architecture can get messy, especially when mixing Scene lifecycle events, game-level events, input events, and custom events without creating memory leaks.
Core Features & Use Cases
- Phaser EventEmitter fundamentals: Learn how Phaser’s EventEmitter (eventemitter3) supports on, once, off, emit, and cleanup via shutdown/destroy.
- Scene vs game event communication: Use
this.events for scene lifecycle and this.game.events as a global event bus across scenes.
- Typed safety via named constants: Prefer Phaser-provided event constants to avoid typo-prone lowercase strings and improve editor autocomplete.
- Practical use cases: Update HUDs from gameplay changes, coordinate inter-scene communication, and prevent duplicated listeners on scene restarts by cleaning up on
shutdown.
Quick Start
Use the events-system skill to correctly register and remove Phaser event listeners in a Scene using named constants, including firing and handling a custom event like player-died.