diff --git a/js/game.js b/js/game.js index 2752ad9..7b2d29c 100644 --- a/js/game.js +++ b/js/game.js @@ -4,7 +4,9 @@ import TILE_TYPES from './tiletypes.js'; export class Tile { constructor(type, direction = 'south') { this.type = type; - this.direction = direction; + if (type.is_actor) { + this.direction = direction; + } this.cell = null; if (type.is_actor) { diff --git a/js/main-editor.js b/js/main-editor.js index 581307f..9b7823f 100644 --- a/js/main-editor.js +++ b/js/main-editor.js @@ -772,6 +772,10 @@ export class Editor extends PrimaryView { return; let type = TILE_TYPES[name]; + let direction; + if (type.is_actor) { + direction = 'south'; + } let cell = this.stored_level.cells[y][x]; // For terrain tiles, erase the whole cell. For other tiles, only // replace whatever's on the same layer @@ -779,7 +783,7 @@ export class Editor extends PrimaryView { // combine e.g. the tent with thin walls if (type.draw_layer === 0) { cell.length = 0; - cell.push({type}); + cell.push({type, direction}); } else { for (let i = cell.length - 1; i >= 0; i--) { @@ -787,7 +791,7 @@ export class Editor extends PrimaryView { cell.splice(i, 1); } } - cell.push({type}); + cell.push({type, direction}); cell.sort((a, b) => a.type.draw_layer - b.type.draw_layer); } } diff --git a/js/main.js b/js/main.js index 7b3dc6c..ad51927 100644 --- a/js/main.js +++ b/js/main.js @@ -1428,7 +1428,7 @@ class Splash extends PrimaryView { cell.push({type: TILE_TYPES['floor']}); stored_level.linear_cells.push(cell); } - stored_level.linear_cells[0].push({type: TILE_TYPES['player']}); + stored_level.linear_cells[0].push({type: TILE_TYPES['player'], direction: 'south'}); // FIXME definitely gonna need a name here chief let stored_game = new format_base.StoredGame(null);