GMS 2 Find How Many Tiles in a Tileset

How do you find how many tiles horizontally, vertically, and over all are in a tileset? I want to add 1 to the tile index of tiles in a tilemap every few frames until I reach the last tile in the tileset, then set the tile index to 1 and start over. How do I get this info from the tileset?
 

Slyddar

Member
Yeh that was the question I had posed. There is no way to get the sprite a tileset is using, afaik.
 

TheMagician

Member
Even though this is an old thread I just wanted to post the answer I found to OPs question - if anyone else stumbles over this topic.

The manual entries for tilemap_get_width and tilemap_get_height contain the code necessary to calculate the total number of tiles in a tileset:

GML:
var lay_id = layer_get_id("Tiles_Walls");
var map_id = layer_tilemap_get_id(lay_id);
var _w = tilemap_get_width(map_id);
var _h = tilemap_get_height(map_id);
total_tiles = (_w * _h);
 
Top