miaoda-game-objective-phaser
v0.3.3
Published
Phaser Scene timed-objective host for miaoda-game-objective-core.
Readme
miaoda-game-objective-phaser
Use this Phaser 4 adapter to advance timed ObjectiveSet goals from Scene updates. Count, set, and sequence objectives work without frame time; only timeout reset windows need ticking.
pnpm add miaoda-game-objective-core miaoda-game-objective-phaserconst objectives = this.objectives.create(definitions);
objectives.core.emit('enemy-defeated');Register ObjectivePlugin for Scene-owned cleanup, or construct ObjectiveController directly with explicit ownership. setTicking(false) pauses timeout progress without clearing objectives. Destroying the controller is terminal and releases Scene events; the core state remains readable for final observation.
For a strict fixed-step game, make timeout ownership explicit and advance it in seconds:
const objectives = this.objectives.create(definitions, { tickSource: 'manual' });
fixedStepper.advance(frameDeltaSeconds, (dtSeconds) => {
objectives.stepSimulation(dtSeconds);
});Host/manual authority, seconds validation, and terminal destruction are checked before objective progress or reset callbacks change. Legacy { autoUpdate: false } plus update(deltaMs) remains compatible; the old method still expects Phaser milliseconds.
