From bb50189644071de1d81e386dd50539517c04907b Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Mon, 7 Sep 2020 14:38:31 -0600 Subject: [PATCH] Actors who start on traps should start the level trapped --- js/main.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index e8052ce..e0e3530 100644 --- a/js/main.js +++ b/js/main.js @@ -197,7 +197,7 @@ class Level { let stored_cell = this.stored_level.linear_cells[n]; n++; - let has_cloner, has_forbidden; + let has_cloner, has_trap, has_forbidden; for (let template_tile of stored_cell) { let tile = Tile.from_template(template_tile); @@ -206,9 +206,14 @@ class Level { tile.specific_hint = template_tile.specific_hint ?? null; } + // TODO well this is pretty special-casey. maybe come up + // with a specific pass at the beginning of the level if (tile.type.name === 'cloner') { has_cloner = true; } + if (tile.type.name === 'trap') { + has_trap = true; + } if (tile.type.is_player) { // TODO handle multiple players, also chip and melinda both @@ -224,6 +229,9 @@ class Level { tile.stuck = true; } else { + if (has_trap) { + tile.stuck = true; + } this.actors.push(tile); } }