Tilorswift fix for save
This commit is contained in:
parent
32a2c15551
commit
c6b0baa533
@ -205,36 +205,36 @@ export default class Tilorswift
|
||||
window.addEventListener(
|
||||
TilorswiftEvent.MENU_SAVE_CLICKED,
|
||||
()=> {
|
||||
if (this.saveLevelToFile(this.level)) {
|
||||
if (this.saveLevelToFile()) {
|
||||
window.dispatchEvent(new TilorswiftSavedEvent());
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
getLevelAsJson(level)
|
||||
getLevelAsJson()
|
||||
{
|
||||
let matrix = [];
|
||||
|
||||
for (let y = 0; y < level.terrain.fields.length; y++) {
|
||||
for (let y = 0; y < this.level.terrain.fields.length; y++) {
|
||||
let row = [];
|
||||
|
||||
for (let x = 0; x < level.terrain.fields[y].length; x++) {
|
||||
row.push(level.terrain.fields[y][x].index);
|
||||
for (let x = 0; x < this.level.terrain.fields[y].length; x++) {
|
||||
row.push(this.level.terrain.fields[y][x].index);
|
||||
}
|
||||
|
||||
matrix.push(row);
|
||||
}
|
||||
|
||||
let data = {
|
||||
tileset: level.getTilesetId(),
|
||||
rows: level.getRows(),
|
||||
columns: level.getColumns(),
|
||||
startX: level.getStartX(),
|
||||
startY: level.getStartY(),
|
||||
targetX: level.getTargetX(),
|
||||
targetY: level.getTargetY(),
|
||||
gravity: level.gravity,
|
||||
tileset: this.level.getTilesetId(),
|
||||
rows: this.level.getRows(),
|
||||
columns: this.level.getColumns(),
|
||||
startX: this.level.getStartX(),
|
||||
startY: this.level.getStartY(),
|
||||
targetX: this.level.getTargetX(),
|
||||
targetY: this.level.getTargetY(),
|
||||
gravity: this.level.gravity,
|
||||
matrix: matrix,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user