Actors who start on traps should start the level trapped

This commit is contained in:
Eevee (Evelyn Woods) 2020-09-07 14:38:31 -06:00
parent de98ba1a60
commit bb50189644

View File

@ -197,7 +197,7 @@ class Level {
let stored_cell = this.stored_level.linear_cells[n]; let stored_cell = this.stored_level.linear_cells[n];
n++; n++;
let has_cloner, has_forbidden; let has_cloner, has_trap, has_forbidden;
for (let template_tile of stored_cell) { for (let template_tile of stored_cell) {
let tile = Tile.from_template(template_tile); let tile = Tile.from_template(template_tile);
@ -206,9 +206,14 @@ class Level {
tile.specific_hint = template_tile.specific_hint ?? null; 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') { if (tile.type.name === 'cloner') {
has_cloner = true; has_cloner = true;
} }
if (tile.type.name === 'trap') {
has_trap = true;
}
if (tile.type.is_player) { if (tile.type.is_player) {
// TODO handle multiple players, also chip and melinda both // TODO handle multiple players, also chip and melinda both
@ -224,6 +229,9 @@ class Level {
tile.stuck = true; tile.stuck = true;
} }
else { else {
if (has_trap) {
tile.stuck = true;
}
this.actors.push(tile); this.actors.push(tile);
} }
} }