Fix hot blocks appearing to move backwards on death

This commit is contained in:
Eevee (Evelyn Woods) 2020-09-19 22:47:04 -06:00
parent 2fc0648333
commit 16f87bf6e0
2 changed files with 9 additions and 3 deletions

View File

@ -356,7 +356,11 @@ export class Level {
// Used to check for a monster chomping the player's tail // Used to check for a monster chomping the player's tail
this.player_leaving_cell = this.player.cell; this.player_leaving_cell = this.player.cell;
// First pass: tick cooldowns and animations; have actors arrive in their cells // First pass: tick cooldowns and animations; have actors arrive in their cells. We do the
// arrival as its own mini pass, for one reason: if the player dies (which will end the game
// immediately), we still want every time's animation to finish, or it'll look like some
// objects move backwards when the death screen appears!
let cell_steppers = [];
for (let actor of this.actors) { for (let actor of this.actors) {
// Actors with no cell were destroyed // Actors with no cell were destroyed
if (! actor.cell) if (! actor.cell)
@ -381,11 +385,14 @@ export class Level {
this._set_prop(actor, 'animation_progress', null); this._set_prop(actor, 'animation_progress', null);
this._set_prop(actor, 'animation_speed', null); this._set_prop(actor, 'animation_speed', null);
if (! this.compat.tiles_react_instantly) { if (! this.compat.tiles_react_instantly) {
cell_steppers.push(actor);
}
}
}
}
for (let actor of cell_steppers) {
this.step_on_cell(actor); this.step_on_cell(actor);
} }
}
}
}
// Second pass: actors decide their upcoming movement simultaneously // Second pass: actors decide their upcoming movement simultaneously
for (let actor of this.actors) { for (let actor of this.actors) {

View File

@ -58,7 +58,6 @@ export class CanvasRenderer {
return; return;
} }
// TODO StoredLevel may not have a tic_counter
let tic = (this.level.tic_counter ?? 0) + tic_offset; let tic = (this.level.tic_counter ?? 0) + tic_offset;
let tw = this.tileset.size_x; let tw = this.tileset.size_x;
let th = this.tileset.size_y; let th = this.tileset.size_y;