-
Notifications
You must be signed in to change notification settings - Fork 45
Question: How can I know which position is clicked by the player ? #95
Comments
I have something quite similar for this in the new What that does is gets the camera's current translation and figures out which chunk the camera is currently directly over. It is actually pretty much similar but you would want to change that code to also deal with which tile it is over. It isn't something that I can really add because you need transform values that are part of the component bundle which the tilemap doesn't exactly directly know. I think some util functions could help in that regard though. |
if the input is a world coordinate, it should be possible to determined the position just by calculation (using the tilemap configuration, tile size especialy) wright ? a means without any tile component access. |
I've been thinking about adding helpers to add that functionality for users of the library because I imagine that many will likely be requiring exactly that. Especially for selecting. Just will look weird because you would need to tell the Tilemap its own translation. |
ok thanks a lot :) |
If I got some times, I will try to write an helper and MR it |
I feel like this is really necessary for the library, and I would prefer if it was some sort of built-in thing instead of having to be manually done. |
It's just a question (but could be turn to be a feature request):
In my game the player can interract with the background. So I need to know which position/tile is clicked.
Is there a way in tilemap to give a screen coordinate (or a world coordinate) and get the matching position/tile ?
by the way thanks for this amazing crate !
The text was updated successfully, but these errors were encountered: