data-manager

Featured

Use this skill when using the Phaser 4 DataManager to store custom key-value data on game objects, listen for data change events, or manage game state. Triggers on: setData, getData, data events, custom data storage.

AI & Automation 957 stars 79 forks Updated today MIT

Install

View on GitHub

Quality Score: 93/100

Stars 20%
99
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# DataManager > Phaser's DataManager provides key-value storage with event-driven change tracking. It operates at three levels: per-GameObject (`sprite.setData`/`getData`), per-Scene (`this.data`), and global (`this.registry`). Every set/change/remove operation emits events, enabling reactive data binding between game systems without tight coupling. **Key source paths:** `src/data/DataManager.js`, `src/data/DataManagerPlugin.js`, `src/data/events/`, `src/gameobjects/GameObject.js` (setData/getData/incData/toggleData) **Related skills:** ../scenes/SKILL.md, ../events-system/SKILL.md ## Quick Start ```js // Per-GameObject data (auto-creates DataManager on first use) const gem = this.add.sprite(100, 100, 'gem'); gem.setData('value', 50); gem.setData({ color: 'red', level: 2 }); gem.getData('value'); // 50 gem.getData(['value', 'color']); // [50, 'red'] // Increment / toggle helpers gem.incData('value', 10); // value is now 60 gem.incData('value', -5); // value is now 55 (negative to decrement) gem.toggleData('active'); // false -> true (starts from false if unset) // Scene-level data (this.data is a DataManagerPlugin) this.data.set('score', 0); this.data.get('score'); // 0 this.data.values.score += 100; // triggers changedata event // Global registry (shared across ALL scenes) this.registry.set('highScore', 9999); // Any scene can read it: this.registry.get('highScore'); // 9999 ``` ## Core Concepts ### DataManager (`Phaser.Data...

Details

Author
autonomous-ai
Repository
autonomous-ai/openharness
Created
1 months ago
Last Updated
today
Language
C
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category