improvement for tilemaps: pixelToTileCoords()
- Dominant language
- Kotlin
- Stars
- 1
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Currently we have no method to transform the screen coordinates from e.g a mouse click to get the tile coordinates to get the tile properties from the tilemap.
ok for normal orthogonal tilemaps it is easy but for staggered isometric tilemaps it is a bit more complicated.
tiled has a cpp implementation for all 4 tilemap types:
https://github.com/mapeditor/tiled/blob/master/src/libtiled/hexagonalrenderer.cpp
https://github.com/mapeditor/tiled/blob/master/src/libtiled/orthogonalrenderer.cpp
https://github.com/mapeditor/tiled/blob/master/src/libtiled/isometricrenderer.cpp
https://github.com/mapeditor/tiled/blob/master/src/libtiled/staggeredrenderer.cpp
maybe it would be good too to get the "real" clicked tile coordinates when someone click on a tile in a layered staggered tile with a collider.
For example the red dots are the clicks and now it would be great to have a method to get the "green highlighted" tiles with coordinates and layer.

Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the four Tiled renderer references in the issue: hexagonalrenderer.cpp, orthogonalrenderer.cpp, isometricrenderer.cpp, and staggeredrenderer.cpp. Compare their coordinate transformations with the tilemap entry points in this repository. Done should include pixelToTileCoords() behavior for the four tilemap types and identify the clicked tile coordinates and layer for layered staggered maps with colliders.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- computer-graphics, game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100