Confused on how to access the data field of STI tiled file
Posted: Fri Sep 22, 2023 12:41 am
I am about to implement some pathfinding in a game I am working on using jumper, and when I looked inside the .lua files generated by tiled I saw that they have an array that seems convertable or usable for this. When i try accessing a layers data field I was expecting this array to be returned but instead I get a table that contains a table, that contains nil
For debugging I've been just doing this
I first get a table, which I was assuming might mean its a 2d array, so then I tried indexing further and got another table?, and the last index is just nil? I must be misunderstanding how to access this mapping. I just want to generate a 2d array for jumper based off the tile ids 2 and 3 (2 being obstacle) (3 being walkable).
For debugging I've been just doing this
Code: Select all
local layer = gameMap.layers["PathFinding"]
print (layer.data[1])
print (layer.data[1][1])
print (layer.data[1][1][1])