From 051730750b1086eb548dfc455a875dcef9ca25a6 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Mon, 31 Aug 2020 12:07:11 -0600 Subject: [PATCH] Always put the player first in actor order --- js/main.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/js/main.js b/js/main.js index b50c625..cbca248 100644 --- a/js/main.js +++ b/js/main.js @@ -243,16 +243,20 @@ class Level { for (let template_tile of stored_cell) { let tile = Tile.from_template(template_tile, x, y); - if (tile.type.is_player) { - // TODO handle multiple players, also chip and melinda both - // TODO complain if no chip - this.player = tile; - } if (tile.type.is_hint) { // Copy over the tile-specific hint, if any tile.specific_hint = template_tile.specific_hint ?? null; } - if (tile.type.is_actor) { + if (tile.type.is_player) { + // TODO handle multiple players, also chip and melinda both + // TODO complain if no chip + this.player = tile; + // Always put the player at the start of the actor list + // (accomplished traditionally with a swap) + this.actors.push(this.actors[0]); + this.actors[0] = tile; + } + else if (tile.type.is_actor) { this.actors.push(tile); } cell.push(tile);