Skip to content

Commit

Permalink
Reformat and release v.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMnD committed Mar 17, 2020
1 parent d966024 commit cab768d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions export_to_godot_tilemap.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*global tiled, TextFile */
class GodotTilemapExporter {

// noinspection DuplicatedCode
constructor(map, fileName) {
this.map = map;
this.fileName = fileName;
// noinspection JSUnresolvedFunction
this.projectRoot = this.map.property("projectRoot");
if(!this.projectRoot) {
if (!this.projectRoot) {
throw new Error("Missing mandatory custom property: projectRoot!");
}
this.projectRoot = this.projectRoot.replace('\\', '/');
Expand Down Expand Up @@ -141,8 +142,8 @@ class GodotTilemapExporter {
* */
let yValue = y;
let xValue = x;
if(xValue < 0) {
yValue = y +1;
if (xValue < 0) {
yValue = y + 1;
}
let firstParam = xValue + (yValue * this.tileOffset);

Expand Down
7 changes: 4 additions & 3 deletions export_to_godot_tileset.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*global tiled, TextFile */
class GodotTilesetExporter {

// noinspection DuplicatedCode
constructor(tileset, fileName) {
this.tileset = tileset;
this.fileName = fileName;
// noinspection JSUnresolvedFunction
this.projectRoot = this.tileset.property("projectRoot");
if(!this.projectRoot) {
if (!this.projectRoot) {
throw new Error("Missing mandatory custom property: projectRoot!");
}
this.projectRoot = this.projectRoot.replace('\\', '/');
Expand Down Expand Up @@ -90,7 +91,7 @@ class GodotTilesetExporter {

exportShapes(tile, autotileCoordinates) {
if (this.firstShapeID === "") {
this.firstShapeID = 'SubResource( ' + tile.id + ' )';
this.firstShapeID = 'SubResource( ' + tile.id + ' )';
}
this.shapes += this.getShapesTemplate(
autotileCoordinates,
Expand Down Expand Up @@ -158,7 +159,7 @@ ${this.shapesResources}[resource]
object.polygon.forEach((coordinate) => {
let coordinateX = (object.x + coordinate.x);
let coordinateY = (object.y + coordinate.y);
coordinateString += coordinateX + ", " + coordinateY + ", ";
coordinateString += coordinateX + ", " + coordinateY + ", ";
});
// Remove trailing commas and blank
coordinateString = coordinateString.replace(/,\s*$/, "");
Expand Down

0 comments on commit cab768d

Please sign in to comment.