Fix walk animation speed; fix occasional camera hiccups
This commit is contained in:
parent
041d0223c7
commit
bd57f686c7
@ -1441,7 +1441,7 @@ class Game {
|
|||||||
// TODO this is not gonna be right while pausing lol
|
// TODO this is not gonna be right while pausing lol
|
||||||
// TODO i'm not sure it'll be right when rewinding either
|
// TODO i'm not sure it'll be right when rewinding either
|
||||||
// TODO or if the game's speed changes. wow!
|
// 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();
|
||||||
this._redraw_handle = requestAnimationFrame(this._redraw_bound);
|
this._redraw_handle = requestAnimationFrame(this._redraw_bound);
|
||||||
|
|||||||
@ -499,7 +499,12 @@ export class Tileset {
|
|||||||
}
|
}
|
||||||
if (coords[0] instanceof Array) {
|
if (coords[0] instanceof Array) {
|
||||||
if (level) {
|
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 {
|
else {
|
||||||
coords = coords[0];
|
coords = coords[0];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user