• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Get Tile Set Number of Tiles?

11clock

Member
Hello, I am making a script that places down random tiles in a specific tile layer. But I cannot figure out how to get the number of tiles in a tile layer's tile set. How do you obtain this information?

Here is the code context.

var lay = layer_get_id("Ground")

if lay != -1 {
var map = layer_tilemap_get_id(lay)

var map_width = tilemap_get_width(map)
var map_height = tilemap_get_height(map)
var set = tilemap_get_tileset(map)

for (var row = 0; row < map_height; row++) {
for (var col = 0; col < map_width; col++) {
tilemap_set(map, irandom_range(1, /*whatever you do to get tile set tile number*/), col, row)
}
}
}
 
Top