Возможно как-то так:
window.onload = function() {
const game = new Game('ctx');
const dot = game.body[0];
const delay = 50;
const minOffset = 1e-3;
let interval = null;
document.addEventListener('mousemove', function(event) {
clearInterval(interval);
interval = setInterval(() => {
const offsetX = (event.clientX - dot.myPos.x) / delay;
const offsetY = (event.clientY - dot.myPos.y) / delay;
dot.myPos = {
x: dot.myPos.x + offsetX,
y: dot.myPos.y + offsetY
};
// останавливаем точку
if (Math.abs(offsetX) < minOffset && Math.abs(offsetX) < minOffset) {
clearInterval(interval);
}
});
});
}