Hi, I’m making a top - down 2D game with enemies that have pathfinding and I’m trying to make them be able to wander around. I was wondering if there was a relatively simple way to give the enemies the ability to read the positions of nearby tiles around them?
Individual cells in a tilemap are identified by cell coordinates which are integers that represent position in a tilemap grid. Those are also called “map coordinates”. To get an actual position of cell’s corner you need to use TileMap(Layer)::map_to_local(), which converts map coordinates to node’s local coordinates. If the node is not transformed, then coordinates returned by that function will coincide with global coordinates. Otherwise you need to additionally transform them to global space using Node2D::to_global()