After drawing the map, I want to export the position of tiles according to the green line as shown below:
Here are the map properties that I use (I use the default value):
This is my export code:
const textPlainFormat = {
name: "Text Plain",
extension: "txt",
write: function(map, fileName) {
var unpassList = [];
for(let i = 0; i < map.layerCount; ++i) {
var layer = map.layerAt(i);
if(layer.isTileLayer) {
for(let y = 0; y < layer.height; ++y) {
for(let x = 0; x < layer.width; ++x) {
var tile = layer.tileAt(x, y);
if(tile != null) {
var isUnpass = tile.property("Unpass"); // The "Unpass" property is the Custom Properties of the tiles and data type is Boolean
if(isUnpass) {
unpassList.push(x);
unpassList.push(y);
}
}
}
}
}
}
var file = new TextFile(fileName, TextFile.WriteOnly);
file.write('Unpass List = ' + JSON.stringify(unpassList));
file.commit();
},
}
tiled.registerMapFormat("txt", textPlainFormat)
When using the above code, the “Unpass” position that I received was rotate right then flip horizontal, formed a red square line instead of the green line.
How do I change the code to be able to export the position like a green line (not rotate right then flip horizontal)?