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