world_to_map not giving "player sprite" correct coordinates

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jobax

Hi I’ve got a top down sprite moving around tile by tile on a tilemap. I’m using world_to_map to force the player sprite to move on each tile. The main problem is that the coordinates for the player are instantly wrong so collisions are completely off.

For example, I’ve got the player sprite in the middle of the map and I’m printing the position like this (Player is referencing the “player” node):

grid_pos = world_to_map(Player.position)

But it’s always at 2, 6. So if I have some tiles placed at the top left and move up 5-6 tiles, my character will be blocked by the tiles (nothing visible) the game thinks should be there e.g. at 2,0. Thanks for any help.

:bust_in_silhouette: Reply From: jobax

Fixed it, positions were way off.