miaoda-game-score-phaser
v0.3.0
Published
Phaser Scene score and combo-window host for miaoda-game-score-core.
Downloads
480
Readme
miaoda-game-score-phaser
Use this Phaser 4 Scene adapter to advance miaoda-game-score-core combo windows from Phaser update time. Score calculation remains in the engine-independent core; the adapter supplies Scene lifecycle and milliseconds-to-seconds conversion.
Install
pnpm add miaoda-game-score-phaser miaoda-game-score-corePhaser >=4 <5 is required.
Minimal controller
const score = scene.scores.create({ window: 1.5, step: 0.25 }, { highScore: 10_000 });
score.core.onScore((entry) => hud.setScore(entry.total));
score.core.add('enemy', 100);Register ScorePlugin as a Scene Plugin to use scene.scores.create(), or construct new ScoreController(scene.events, combo, options) directly. Phaser delta milliseconds are converted to seconds before core.tick.
Use setTicking(false) while score combo time should be paused. With autoUpdate: false, call update(deltaMs) from your chosen simulation coordinator. Scene shutdown destroys plugin-owned controllers automatically.
Public API
ScoreController exposes core, setTicking, update, and destroy. ScorePlugin creates Scene-owned score systems. The adapter does not render a HUD or award points automatically.
