Sam04
Member
Is there a way to get the tile width and tile height of a tileset. I checked the manual and, apparently, the only functions related to tilesets are to get their texture information.
I need them because I want to create tilemaps, but one of the required data to create one is how many cells it will use. I want them to cover the entire room, so the obvious answer will be something like:
But, for that I need the information I am lacking. The good thing about tilesets is that they always have the same tile width and height no matter what; but if I am dynamically creating tilemaps through code using tilesets with different tile width and height I need a way to check this info through code so it always uses the right number.
A workaround (not a solution) would be to have a global array filled with structs that each has a reference to a tileset and a to their tile width and height... but I would like to avoid this workaround because of how it is error prone and I need to manually update it whenever I make some change in the tilesets or create/delete some tileset.
I need them because I want to create tilemaps, but one of the required data to create one is how many cells it will use. I want them to cover the entire room, so the obvious answer will be something like:
new_tilemap = layer_tilemap_create(target_layer, 0,0, tileset, room_width div tile_width, room_height div tile_height);
But, for that I need the information I am lacking. The good thing about tilesets is that they always have the same tile width and height no matter what; but if I am dynamically creating tilemaps through code using tilesets with different tile width and height I need a way to check this info through code so it always uses the right number.
A workaround (not a solution) would be to have a global array filled with structs that each has a reference to a tileset and a to their tile width and height... but I would like to avoid this workaround because of how it is error prone and I need to manually update it whenever I make some change in the tilesets or create/delete some tileset.