Fix hot blocks appearing to move backwards on death
This commit is contained in:
parent
2fc0648333
commit
16f87bf6e0
11
js/game.js
11
js/game.js
@ -356,7 +356,11 @@ export class Level {
|
||||
// Used to check for a monster chomping the player's tail
|
||||
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) {
|
||||
// Actors with no cell were destroyed
|
||||
if (! actor.cell)
|
||||
@ -381,11 +385,14 @@ export class Level {
|
||||
this._set_prop(actor, 'animation_progress', null);
|
||||
this._set_prop(actor, 'animation_speed', null);
|
||||
if (! this.compat.tiles_react_instantly) {
|
||||
this.step_on_cell(actor);
|
||||
cell_steppers.push(actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let actor of cell_steppers) {
|
||||
this.step_on_cell(actor);
|
||||
}
|
||||
|
||||
// Second pass: actors decide their upcoming movement simultaneously
|
||||
for (let actor of this.actors) {
|
||||
|
||||
@ -58,7 +58,6 @@ export class CanvasRenderer {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO StoredLevel may not have a tic_counter
|
||||
let tic = (this.level.tic_counter ?? 0) + tic_offset;
|
||||
let tw = this.tileset.size_x;
|
||||
let th = this.tileset.size_y;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user