I am attempting to loop through layer data and place a Tree class (uses custom mask and depth setting) in an isometric setup. tileToworldX and tileToWorldY always returns undefined. I have logged out the myx and myx for the tile index to the console and the index shows up fine. Here’s the nested loop for the insert:
for (var i=0; i<layer2.layer.data.length; i++){
for(var j=0; j<layer2.layer.data[i].length; j++){
var data = layer2.layer.data[i][j].index;
if (data != -1){
var myx = layer2.layer.data[i][j].x;
var myy = layer2.layer.data[i][j].y;
console.log(layer2.tileToWorldX(myx, [this.cameras.main], layer2) + ", " + layer2.tileToWorldY(myy, [this.cameras.main], layer2));
new Tree(this, layer2.tileToWorldX(myx, [this.cameras.main], layer2), layer2.tileToWorldY(myy, [this.cameras.main], layer2), shapes.Tree);
}
}
}