events-system

Manage Phaser 4 EventEmitter communication across scenes and game systems.

Updated Apr 20, 2026
One-click install
npx skills add https://github.com/Raphe-dev/phaser-cozy-mmo --skill events-system-raphe-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: events-system
Source: https://github.com/Raphe-dev/phaser-cozy-mmo/tree/main/skills/events-system
Command: npx skills add https://github.com/Raphe-dev/phaser-cozy-mmo --skill events-system-raphe-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Coordinating complex communication across Phaser 4's events and EventEmitter system can be verbose and error-prone. This skill provides a structured overview of EventEmitter usage, scene vs game events, and per-key listeners to bring consistency and reliability to event-driven gameplay.

Core Features & Use Cases

  • Central EventEmitter usage across major systems (Scene, Game, Input, etc.)
  • Scene lifecycle integration and safe cleanup to prevent leaks
  • Per-key events and constants-based listening to reduce typos
  • Custom events and inter-scene communication patterns

Quick Start

Add scene-level listeners with this.events and optionally global listeners with this.game.events to start handling lifecycle and custom events.

Frequently Asked Questions about events-system

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

FAQPage Schema
How do I manage Phaser scene events and EventEmitter communication across game systems?

To manage Phaser scene events and EventEmitter communication, use this.events for scene-level listeners and this.game.events for global events. This pattern separates scene lifecycles from game-wide systems to coordinate event-driven gameplay reliably.

What is the best way to prevent event listener leaks during Phaser scene lifecycles?

Preventing event listener leaks requires applying safe cleanup guidance during Phaser scene lifecycles. Removing listeners via the off API when scenes shutdown ensures EventEmitter instances do not retain stale references and cause memory leaks.

How do I communicate between Phaser scenes using custom events?

Inter-scene communication uses Phaser.Events.EventEmitter to emit and listen for custom events. Scenes exchange data by routing per-key event constants through a central EventEmitter rather than direct scene references.

Does Phaser 4 EventEmitter support per-key events and constants-based listening?

Yes, Phaser 4 EventEmitter supports per-key events and constants-based listening. Defining event constants reduces typos and ensures consistent event names across on, once, and off API calls.

Why should I separate scene events from game events in Phaser?

Separating scene events from game events prevents scope confusion and unexpected listener triggers. Scene events handle local lifecycle logic while game events manage global systems, ensuring clear separation and reliable event-driven architecture.

How do I set up Phaser EventEmitter listeners for Input and other subsystems?

Set up Phaser EventEmitter listeners by attaching on and once handlers to subsystems like Input via this.events. Coordinate these flows by using defined event constants to route communication cleanly across Game and Scene objects.