Always put the player first in actor order

This commit is contained in:
Eevee (Evelyn Woods) 2020-08-31 12:07:11 -06:00
parent 730824e697
commit 051730750b

View File

@ -243,16 +243,20 @@ class Level {
for (let template_tile of stored_cell) { for (let template_tile of stored_cell) {
let tile = Tile.from_template(template_tile, x, y); 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) { if (tile.type.is_hint) {
// Copy over the tile-specific hint, if any // Copy over the tile-specific hint, if any
tile.specific_hint = template_tile.specific_hint ?? null; 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); this.actors.push(tile);
} }
cell.push(tile); cell.push(tile);