diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-12-29 19:01:42 +0000 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-12-29 19:01:42 +0000 |
commit | 59fb8631e3e7f3fa4f643eaf44ad15fba03229fd (patch) | |
tree | fac3b9a1ad6d7a91b0646f9d9172a929796ee069 /js | |
parent | 0a24e427bd19953d1f1675ff22ae80bec58f3ac0 (diff) | |
download | js-canvas-2023-59fb8631e3e7f3fa4f643eaf44ad15fba03229fd.tar.gz js-canvas-2023-59fb8631e3e7f3fa4f643eaf44ad15fba03229fd.zip |
Time is in msec, the update dt is in sec
Diffstat (limited to 'js')
-rw-r--r-- | js/game.js | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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(); |