events-system

Implements event-driven communication in Phaser games using EventEmitter patterns and named event constants.

Updated Jun 10, 2026
One-click install
npx skills add https://github.com/mudman1986/quarterless --skill events-system-mudman1986
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: events-system
Source: https://github.com/mudman1986/quarterless/tree/main/.github/skills/events-system
Command: npx skills add https://github.com/mudman1986/quarterless --skill events-system-mudman1986

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Phaser games rely on events for scene lifecycle, input, loading, animations, and inter-scene communication, but remembering event names, emitter scopes, and listener cleanup rules is error-prone and causes memory leaks. ## Core Features & Use Cases - Complete Event Reference: Covers all Phaser event namespaces including Scene, Core, Input, Loader, Animations, Cameras, Sound, Tweens, Physics, Textures, GameObjects, and Time events with their string values and constants. - Listener Lifecycle Guidance: Explains on, once, off, and removeAllListeners usage, context binding, and shutdown cleanup patterns to prevent duplicate listeners on scene restarts. - Inter-Scene Communication Patterns: Documents game.events as a global bus, the registry DataManager, and direct scene access for cross-scene messaging. - Use Case: When building a Phaser scene that listens for pointer input and emits a custom player-died event, use this Skill to wire listeners with named constants and clean them up on SHUTDOWN. ## Quick Start Ask the AI to add a pointerdown listener in a Phaser scene that emits a custom event and is properly removed 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?

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 like Phaser.Input.Events.POINTER_DOWN over raw strings to avoid typos.

How do scenes communicate with each other in Phaser?

Scenes communicate through game.events as a global event bus, through this.registry which is a shared DataManager firing changedata events, or by directly accessing another scene with this.scene.get('SceneKey').events.emit.

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

Listeners registered with on persist across scene restarts, so each restart adds duplicates. Remove them in a SHUTDOWN handler using off with the exact same function reference and context, or use once for single-fire listeners.

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

this.events is the scene-level emitter firing scene lifecycle events and is cleaned up when the scene is destroyed. this.game.events is a global emitter for game-level events like blur and focus that persists across scene restarts.

How do I remove an event listener in Phaser?

Call off with the exact same function reference and context passed to on, for example this.input.off('pointerdown', this.onPointerDown, this). Anonymous arrow functions cannot be removed, so store a reference or use a class method.