Topic was automatically imported from the old Question2Answer platform.
Asked By
jujumumu
Is there a function in godot that can get the dimensions of the atlas tile. For example using tile_set.tile_get_region(id) gives the dimensions but in pixel size. But when you create an atlas tile you define a size of the grids(step). Is there a function to return the step? Then I could just use tile_set.tile_get_region(id)/get_step()
To then get the amount of tiles in the atlas you would do:
var region_size = $TileMap.tile_set.tile_get_region(0).size
var subtile_size = $TileMap.tile_set.autotile_get_size(0)
var dimensions = region_size / subtile_size
var subtile_amount = ceil(dimensions.x) * ceil(dimensions.y)
Ceiling is important if your region isn’t perfectly aligned with the grid.