SOLVED how to use layer_tilemap_get_id for a whole folder instead of just 1 single tileset?

jobjorgos

Member
layer_tilemap_get_id(layer_get_id("Col")); works fine to find the tileset "Col".

but now I moved tileset "Col" into the "Buildings" folder:
dfg.png

How can I make the "Buildings" folder the ID so all the tilesets this folder contains will be set at the same time?
Or can I only set 1 single tileset as ID at the same time?

layer_tilemap_get_id(layer_get_id("Buildings")); didn't seem to work.
 

jobjorgos

Member
Ok I just found that it is not possible: https://forum.yoyogames.com/index.php?threads/layer_get_id-and-layer-folders.17770/
Folders are purely organisational within the IDE and can not set


Then plan B was to make an array of all tilemaps within the "Buildings" folder:
Create Event:
collisionMap[0] = layer_tilemap_get_id(layer_get_id("Col")); collisionMap[1] = layer_tilemap_get_id(layer_get_id("Foilage_Goes_Over_ALL"));
Step Event:
GML:
if tilemap_get_at_pixel(collisionMap, x, y ){

    //do collision

}
but then I got the following error:
tilemap_get_at_pixel argument 1 incorrect type (array) expecting a Number


So afterall I tried plan C and this worked:
Create Event:
collisionMap[0] = layer_tilemap_get_id(layer_get_id("Col")); collisionMap[1] = layer_tilemap_get_id(layer_get_id("Foilage_Goes_Over_ALL"));
Step Event:
GML:
size = array_length(collisionMap)
for(var i = 0; i < size; i++) {
    if tilemap_get_at_pixel(collisionMap, x, y ){
        //do collision
    }
}
 
Top