events-system

Coordinate in-game events across Phaser scenes using the EventEmitter pattern.

Updated Apr 16, 2026
One-click install
npx skills add https://github.com/GiantCroissant-Lunar/proto-breakout --skill events-system-giantcroissant-lunar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: events-system
Source: https://github.com/GiantCroissant-Lunar/proto-breakout/tree/main/.agent/skills/01-phaser/events-system
Command: npx skills add https://github.com/GiantCroissant-Lunar/proto-breakout --skill events-system-giantcroissant-lunar

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Coordinating in-game events across Phaser scenes requires a robust event system. This skill teaches you to leverage the EventEmitter pattern to orchestrate Game, Scene, and Object events, reduce tight coupling, and simplify lifecycle-driven logic.

Core Features & Use Cases

  • EventEmitter-based communication across the game.
  • Safe listener management using on/once/off, with proper context binding.
  • Distinction between Scene events (this.events) and Game events (this.game.events) for scoped, cross-scene coordination.
  • Use of named constants to avoid typos and enable IDE autocomplete.
  • Common patterns: scene lifecycle hooks, inter-scene messaging, and custom event flows.

Quick Start

Hook up listeners on this.events and this.game.events to begin 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 communicate between scenes?

You manage Phaser scene events by hooking listeners to this.events for scene lifecycles and this.game.events for cross-scene messaging, using the EventEmitter pattern to coordinate custom event flows.

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

The difference is that this.events handles scoped Scene events like lifecycle hooks, while this.game.events handles Game events for broader cross-scene communication within the Phaser EventEmitter system.

How do I prevent memory leaks when removing Phaser event listeners?

To prevent memory leaks in Phaser, use the off method to remove listeners and apply proper cleanup patterns during scene lifecycles, ensuring proper this binding when managing on and once subscriptions.

Can I use on once and off methods for custom events in Phaser 4?

Yes, you can use on, once, and off methods to handle custom events in Phaser 4, applying named constants for event keys to avoid typos and enable IDE autocomplete while managing listener context binding.

Why should I use named constants for Phaser event keys?

You should use named constants for Phaser event keys to avoid string typos and enable IDE autocomplete, ensuring safe listener management and reliable event dispatching across inter-scene messaging flows.

What's the best way to decouple Phaser scene logic using the EventEmitter?

The best way to decouple Phaser scene logic is leveraging the EventEmitter pattern for inter-scene messaging and lifecycle-driven hooks, reducing tight coupling by coordinating Game and Object events asynchronously.