Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Ledwan |
I have a 2D kinematic body named “spider” and a TileMap in the same scene. I want the player to ‘die’ when on a certain tile.
The code I tried for this is mostly attempts at using world_to_map and get_cellv, and whenever it runs I just get -1 or (0, 0), so I’m left confused. I’m still quite new to Godot and can’t get it working at all, so any help would be appreciated.
code on a 2D node:
var posx = player.position.x
var posy = player.position.y
print(map.world_to_map(Vector2(posx, posy))) – output: (0, 0)