You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
The text was updated successfully, but these errors were encountered:
Issue
The
Layer_Tiles
has the useful functiongetTileStackAt()
orhasAnyTileAt()
. 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:ldtk-haxe-api/src/ldtk/Layer_IntGrid_AutoLayer.hx
Line 7 in 4ff1942
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()
orhasAnyTileAt()
to theLayer_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 privateMap<Int, Array<Int>>
which just contains indices to theautoTiles
variable. Or alternative 2 is to make theautoTitles
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.
The text was updated successfully, but these errors were encountered: