Documentation / @debuffjp/core / smoothMotion
Function: smoothMotion()
smoothMotion(
game,objects):SmoothMotion
Defined in: ../debuff/packages/core/src/smooth.ts:96
Smooth drawing between fixed steps for the objects objects returns, read before every step.
ts
const smooth = smoothMotion(game, () => [player, enemies, shots]);
// in render:
draw.sprite(img, smooth.x(player), smooth.y(player));
for (const e of enemies) draw.sprite(enemyImg, smooth.x(e), smooth.y(e));
// after moving something instantly:
smooth.snap(player);