Description
Issue
The Layer_Tiles
has the useful function getTileStackAt()
or hasAnyTileAt()
. However, if you use an IntGrid or AutoLayer, there is no such way to get the tiles by integer coordinates. The only public value currently is:
Which only exposes the pixel positions:
ldtk-haxe-api/src/ldtk/Layer_AutoLayer.hx
Lines 4 to 13 in 4ff1942
It would be nice to add getTileStackAt()
or hasAnyTileAt()
to the Layer_IntGrid_AutoLayer
class.
Potential solutions
I'd propose to add a new variable which is a map, like it the Tiles layer:
ldtk-haxe-api/src/ldtk/Layer_Tiles.hx
Line 4 in 4ff1942
Then we can use coordinate IDs to find the right tile. The only problem here is that we'd be duplicating data with the autoTiles
variable (changing it would be backwards incompatible since the variable is public). As an alternative 1 we can create a private Map<Int, Array<Int>>
which just contains indices to the autoTiles
variable. Or alternative 2 is to make the autoTitles
a Haxe property with a getter function that is backed by the new variable. I think i prefer alternative 2.
What do you think? Happy to try to make a pull request with the preferred solution.