aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-12-29 19:01:42 +0000
committerJuan J. Martinez <jjm@usebox.net>2023-12-29 19:01:42 +0000
commit59fb8631e3e7f3fa4f643eaf44ad15fba03229fd (patch)
treefac3b9a1ad6d7a91b0646f9d9172a929796ee069 /js
parent0a24e427bd19953d1f1675ff22ae80bec58f3ac0 (diff)
downloadjs-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.js4
1 files changed, 2 insertions, 2 deletions
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();