I want to make a board game and get every position of a tile so I can "move" the player in the board. I tried local_to_map but I need a map position. Is this way correct and if so, how to define a map position to get all tile positions dynamically?
Get position of every tile using Tilemap
GameDevWannaBe You probably want its counterpart map_to_local()
xyz Thanks for the reply. Do you know what map_position specifically is?
GameDevWannaBe It's tile coordinate.
But I want to get the tile coordinates.
GameDevWannaBe What do you mean by "tile coordinates"?
The position of every tile(x and y)
- Edited
GameDevWannaBe The question is in which coordinate space you need the position in. Map space uses integer coordinates where tiles have coordinates (0,0), (1,0), (2,0) etc. which are independent of tile size, or local space where each tile center has "real" coordinates that depend on tile size. The question is which coordinates you know and which ones you need to calculate.
To save time, best to describe what exactly you're trying to achieve.
I want to get local or absolute position without having the other, just with TileMap rendering. Is this possible?
- Edited
GameDevWannaBe You need to have some input, i.e. some kind of positional information. You can't get global position of nothing
xyz The TileMap node renders tiles in a position I clicked with the mouse. Is there a way to get that?
- Edited
GameDevWannaBe You can't get mouse click positions. You can get individual tile corner (or center) position though. That's precisely what map_to_local()
returns. However you need to give it a map coordinate of an individual tile as an input.
xyz Thank you. The problem was that I didn't know what the variable map_position even is. Now I get it. Thank you for your patience and your answers!!