events-system

Implements event-driven communication using Phaser's EventEmitter across scenes, input, and game systems.

2|10|Updated Jul 28, 2026
One-click install
npx skills add https://github.com/kodingvibes/gamejam-2026 --skill events-system-kodingvibes
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: events-system
Source: https://github.com/kodingvibes/gamejam-2026/tree/main/participantes/jpyunism/.agents/skills/events-system
Command: npx skills add https://github.com/kodingvibes/gamejam-2026 --skill events-system-kodingvibes

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Phaser games rely on the EventEmitter pattern across every major system, but remembering event names, emitter scopes, and listener cleanup rules is error-prone. This Skill provides a complete reference for wiring up events correctly, preventing memory leaks and typos in event-driven game code. ## Core Features & Use Cases - Complete Event Reference: Covers all event namespaces including Scene, Game, Input, Loader, Animations, Cameras, Sound, Tweens, Arcade Physics, Textures, GameObjects, and Time, with constant-to-string mappings. - Listener Lifecycle Patterns: Shows correct usage of on, once, off, and removeAllListeners, including context binding and shutdown cleanup to prevent duplicate listeners on scene restart. - Inter-Scene Communication: Documents three methods for cross-scene messaging using game.events, the registry DataManager, and direct scene access. - Use Case: When building a Phaser game where a UI scene must react to score changes in the gameplay scene, use this Skill to set up a game.events listener with proper shutdown cleanup. ## Quick Start Ask the AI to show how to emit a custom event from one Phaser scene and listen for it in another scene with proper cleanup on shutdown.

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.events, this.input, or this.game.events, passing the event name and a callback. Prefer named constants like Phaser.Scenes.Events.UPDATE over raw strings to avoid typos.

How to communicate between scenes in Phaser?▼

Use this.game.events as a global event bus shared across scenes, or use this.registry to set data and listen for changedata events. You can also emit directly on another scene via this.scene.get('SceneKey').events.

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 same function reference and context, or use once for single-fire events.

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

this.events is scene-specific and fires scene lifecycle events like update and shutdown. this.game.events is global, fires game-level events like blur and focus, and persists across scene restarts, so its listeners need manual cleanup.

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

No, off requires the exact same function reference passed to on, so inline arrow functions cannot be removed. Store the handler in a variable or use a class method, and pass the same context as the third argument.