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
{{ message }}
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.
That console print will print identical coordinates for all tiles, except on last column it returns -1,N and on last row returns empty result.
First click after reloading the page, works correctly, but not consecutive clicks.
If i simply call aaa.getAt({ x: 0, y: 0 }) directly, once, without doing anything with the return value, all onClick events will have getAt return tiles with offset +1,+1
so currently, i pretty much have to call getAt manually once, and subtract 1,1 from the return value inside onClick.
Or maybe somebody knows how to make addLevel accept more than one sprite for a tile. Because that is the original problem I had, which made me implement layers as separate addLevel levels on top of each other, since adding multiple sprites to a tile only renders the last one, and child objects of a tile ignore z level.
EDIT: I think I found the problem, I looked at the source, and getAt checks if the spatial map exists, and if it doesn't creates it, and does it only once, so jus in case, i tried to simply call getSpatialMap() right after addLevel and that fixes it, no offset from getAt if i trick it to create the spatial map right after creating the level.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Simplified example:
That console print will print identical coordinates for all tiles, except on last column it returns -1,N and on last row returns empty result.
First click after reloading the page, works correctly, but not consecutive clicks.
If i simply call
aaa.getAt({ x: 0, y: 0 })
directly, once, without doing anything with the return value, all onClick events will have getAt return tiles with offset +1,+1so currently, i pretty much have to call getAt manually once, and subtract 1,1 from the return value inside onClick.
Or maybe somebody knows how to make addLevel accept more than one sprite for a tile. Because that is the original problem I had, which made me implement layers as separate addLevel levels on top of each other, since adding multiple sprites to a tile only renders the last one, and child objects of a tile ignore z level.
EDIT: I think I found the problem, I looked at the source, and
getAt
checks if the spatial map exists, and if it doesn't creates it, and does it only once, so jus in case, i tried to simply callgetSpatialMap()
right afteraddLevel
and that fixes it, no offset fromgetAt
if i trick it to create the spatial map right after creating the level.Beta Was this translation helpful? Give feedback.
All reactions