The MapManager service provides access to several commonly used operations involving the map. You can get an instance of the MapManager at Services.MapManager
.
The MapManager also keeps a list of all of the TileMaps that are being used to draw the scene. Tileset scenes should register their TileMap nodes with the MapManager service using the register_map()
method. TileMaps are automatically unregistered when the scene is changed. Additionally TileMaps should have their global position set to Vector2(0,0)
and have a cell_size
that matches or is a clean multiple of Services.MapManager.cell_size()
.
Corners {UPPER_LEFT, UPPER_RIGHT, LOWER_LEFT, LOWER_RIGHT}
Sides {TOP, RIGHT, BOTTOM, LEFT}
world_to_map(position: Vector2) → Vector2
map_to_world(position: Vector2) → Vector2
cell_size() → Vector2
tile_bounding_box(position: Vector2) → Array
center_of_tile(position: Vector2) → Vector2
position_in_tile(position: Vector2, tile: Vector2) → bool
near_edge_of_tile(position: Vector2, tile: Vector2, threshold: float)
interactables_on_tile(position: Vector2) → Array
register_map(new_map: TileMap, registered_name: String)
unregister_map(registered_name: String)
get_registered_maps() → Dictionary