diff --git a/js/main.js b/js/main.js index e137c40..1b3a2a0 100644 --- a/js/main.js +++ b/js/main.js @@ -1441,7 +1441,7 @@ class Game { // TODO this is not gonna be right while pausing lol // TODO i'm not sure it'll be right when rewinding either // TODO or if the game's speed changes. wow! - this.tic_offset = (performance.now() - this.last_advance) / 1000 / (1 / TICS_PER_SECOND) % 1; + this.tic_offset = Math.min(1, (performance.now() - this.last_advance) / 1000 / (1 / TICS_PER_SECOND)); this._redraw(); this._redraw_handle = requestAnimationFrame(this._redraw_bound); diff --git a/js/tileset.js b/js/tileset.js index 604fe9d..52aaaff 100644 --- a/js/tileset.js +++ b/js/tileset.js @@ -499,7 +499,12 @@ export class Tileset { } if (coords[0] instanceof Array) { if (level) { - coords = coords[Math.floor((level.tic_counter % 5 + level.tic_offset) / 5 * coords.length)]; + if (tile.animation_speed) { + coords = coords[Math.floor((tile.animation_progress + level.tic_offset) / tile.animation_speed * coords.length * 0.999)]; + } + else { + coords = coords[Math.floor((level.tic_counter % 5 + level.tic_offset) / 5 * coords.length)]; + } } else { coords = coords[0];