Let's just guarantee that tic_offset is never 1

This commit is contained in:
Eevee (Evelyn Woods) 2020-09-03 10:31:46 -06:00
parent bd57f686c7
commit 15d3d43b76
2 changed files with 2 additions and 2 deletions

View File

@ -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 = Math.min(1, (performance.now() - this.last_advance) / 1000 / (1 / TICS_PER_SECOND));
this.tic_offset = Math.min(0.9999, (performance.now() - this.last_advance) / 1000 / (1 / TICS_PER_SECOND));
this._redraw();
this._redraw_handle = requestAnimationFrame(this._redraw_bound);

View File

@ -500,7 +500,7 @@ export class Tileset {
if (coords[0] instanceof Array) {
if (level) {
if (tile.animation_speed) {
coords = coords[Math.floor((tile.animation_progress + level.tic_offset) / tile.animation_speed * coords.length * 0.999)];
coords = coords[Math.floor((tile.animation_progress + level.tic_offset) / tile.animation_speed * coords.length)];
}
else {
coords = coords[Math.floor((level.tic_counter % 5 + level.tic_offset) / 5 * coords.length)];