From ade135514b0cceebce23b2ae856818ba3b4b0cd4 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Mon, 28 Sep 2020 00:38:24 -0600 Subject: [PATCH] Undo actor animation (fixes #4) --- js/game.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/js/game.js b/js/game.js index df2f551..084947a 100644 --- a/js/game.js +++ b/js/game.js @@ -795,10 +795,9 @@ export class Level { if (actor.cell === goal_cell) return; - // TODO undo this stuff? - actor.previous_cell = actor.cell; - actor.animation_speed = speed; - actor.animation_progress = 0; + this._set_prop(actor, 'previous_cell', actor.cell); + this._set_prop(actor, 'animation_speed', speed); + this._set_prop(actor, 'animation_progress', 0); let original_cell = actor.cell; this.remove_tile(actor); @@ -1078,8 +1077,8 @@ export class Level { spawn_animation(cell, name) { let type = TILE_TYPES[name]; let tile = new Tile(type); - tile.animation_speed = type.ttl; - tile.animation_progress = 0; + this._set_prop(tile, 'animation_speed', tile.type.ttl); + this._set_prop(tile, 'animation_progress', 0); cell._add(tile); this.actors.push(tile); this.pending_undo.push(() => {