From 59fb8631e3e7f3fa4f643eaf44ad15fba03229fd Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Fri, 29 Dec 2023 19:01:42 +0000 Subject: Time is in msec, the update dt is in sec --- js/game.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/game.js b/js/game.js index 069618c..364fb8f 100644 --- a/js/game.js +++ b/js/game.js @@ -90,8 +90,8 @@ class Game { } loop(now) { - let dt = min(1 / this.minFps, now - this.then); - this._update(dt); + let dt = min(1000 / this.minFps, now - this.then); + this._update(dt/1000); this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); this.ctx.save(); -- cgit v1.2.3