miaoda-game-path-phaser
v0.3.0
Published
Phaser 4 Game Object path follower for miaoda-game-path-core.
Readme
miaoda-game-path-phaser
Use this Phaser 4 adapter to bind a Game Object to a baked miaoda-game-path-core route. It converts Scene delta milliseconds to seconds, optionally rotates to the tangent, and cleans up on Scene shutdown.
Install and use
pnpm add miaoda-game-path-core miaoda-game-path-phaser phaserRegister PathPlugin, then create a mover:
const mover = this.paths.create(enemy, bakedPath, {
speed: 260,
mode: 'clamp',
rotationOffset: -90,
sway: { amplitude: 18, frequency: 1.2 },
onArrive: () => beginCombat(enemy),
});Direct new PathMover(...) construction is available when your code owns lifecycle cleanup. Non-finite options or frame deltas are ignored without changing the object transform or firing arrival callbacks. destroy() and Scene shutdown are terminal: later ticking, speed, seek, or update calls are inert and cannot write the Game Object.
The adapter owns Scene timing and Game Object transforms only. Path geometry, distance sampling, and follower state remain in core; collision and behavior handoff remain game-owned.
