Undo actor animation (fixes #4)

This commit is contained in:
Eevee (Evelyn Woods) 2020-09-28 00:38:24 -06:00
parent 684021f93d
commit ade135514b

View File

@ -795,10 +795,9 @@ export class Level {
if (actor.cell === goal_cell) if (actor.cell === goal_cell)
return; return;
// TODO undo this stuff? this._set_prop(actor, 'previous_cell', actor.cell);
actor.previous_cell = actor.cell; this._set_prop(actor, 'animation_speed', speed);
actor.animation_speed = speed; this._set_prop(actor, 'animation_progress', 0);
actor.animation_progress = 0;
let original_cell = actor.cell; let original_cell = actor.cell;
this.remove_tile(actor); this.remove_tile(actor);
@ -1078,8 +1077,8 @@ export class Level {
spawn_animation(cell, name) { spawn_animation(cell, name) {
let type = TILE_TYPES[name]; let type = TILE_TYPES[name];
let tile = new Tile(type); let tile = new Tile(type);
tile.animation_speed = type.ttl; this._set_prop(tile, 'animation_speed', tile.type.ttl);
tile.animation_progress = 0; this._set_prop(tile, 'animation_progress', 0);
cell._add(tile); cell._add(tile);
this.actors.push(tile); this.actors.push(tile);
this.pending_undo.push(() => { this.pending_undo.push(() => {