2d_warrior
Member
There seems to be a bug with tilemap ids, but I'm not sure. When I add visible instances with sprites to my room I get the name of the background instead of a tilemap in spite of the fact that I use "if layer_get_element_type(a) == layerelementtype_tilemap" before adding the name and id of the tilemap to arrays. If I add more than 3 visible instances with sprites it errors and acts like the array is out of bounds. If I remove the background color layer then instead of the background name "Backgrounds_1" showing up as if it's a tilemap, the number of layer slots in my tilemap_name_list[tilemap_layers] array (and other arrays) are reduced, but it still starts with "Sun." The array goes in reverse order to give me furthest layer first, but I still get the problem the other way too.
My layers are:
Instances,Grass,Clouds, Sun,Background_1
(The middle 3 are tilemaps.)
Tilemap_Find_obj
Create:
//Get the tile layer arrays from the room
Empty_Sprite_Obj
Testing It
1.Works fine if you don't add sprite based instances.
2. Place the 1 Empty_Sprite_Obj in the room in the instance layer. Array is in wrong place.
3. Add 4 Empty_Sprite_Obj intances total, and you get an out of bounds error.
Download at
https://www.dropbox.com/s/p551bpgaolizoio/Tilemap Error.yyz?dl=0
Images below contain some extra variables before I narrowed down where things were going wrong, The tilemap names, and ids are the problem in the images.
Is this a bug, or is there something I can do to fix it in my game, and if so what? If it is a bug is there any workaround?
My layers are:
Instances,Grass,Clouds, Sun,Background_1
(The middle 3 are tilemaps.)
Tilemap_Find_obj
Create:
//Get the tile layer arrays from the room
a = layer_get_all()
i=array_length_1d(a)-1
tilemap_layers=0
while (i >0)
Draw GUI:i=array_length_1d(a)-1
tilemap_layers=0
while (i >0)
{
if layer_get_element_type(a [ i ] ) == layerelementtype_tilemap
}
if layer_get_element_type(a [ i ] ) == layerelementtype_tilemap
{
tilemap_id_list[tilemap_layers]=layer_tilemap_get_id(i)
tilemap_name_list[tilemap_layers]=layer_get_name(i)
tilemap_x_list[tilemap_layers]=tilemap_get_x(i)
tilemap_y_list[tilemap_layers]=tilemap_get_y(i)
tilemap_tile_w_list[tilemap_layers]=tilemap_get_tile_width(i)
tilemap_tile_h_list[tilemap_layers]=tilemap_get_tile_height(i)
//how many tilemap layers we have
tilemap_layers+=1
}
i+=-1tilemap_id_list[tilemap_layers]=layer_tilemap_get_id(i)
tilemap_name_list[tilemap_layers]=layer_get_name(i)
tilemap_x_list[tilemap_layers]=tilemap_get_x(i)
tilemap_y_list[tilemap_layers]=tilemap_get_y(i)
tilemap_tile_w_list[tilemap_layers]=tilemap_get_tile_width(i)
tilemap_tile_h_list[tilemap_layers]=tilemap_get_tile_height(i)
//how many tilemap layers we have
tilemap_layers+=1
}
}
//Drawing the results.
draw_text(0,0,"tilemap id " + string(tilemap_id_list))
draw_text(0,20,"tilemap name " + string(tilemap_name_list))
draw_text(0,40,"tilemap layers " + string(tilemap_layers))
draw_text(0,60,"tilemap x list " + string(tilemap_x_list))
draw_text(0,80,"tilemap y list " + string(tilemap_y_list))
draw_text(0,0,"tilemap id " + string(tilemap_id_list))
draw_text(0,20,"tilemap name " + string(tilemap_name_list))
draw_text(0,40,"tilemap layers " + string(tilemap_layers))
draw_text(0,60,"tilemap x list " + string(tilemap_x_list))
draw_text(0,80,"tilemap y list " + string(tilemap_y_list))
Empty_Sprite_Obj
visible=true
Testing It
1.Works fine if you don't add sprite based instances.
2. Place the 1 Empty_Sprite_Obj in the room in the instance layer. Array is in wrong place.
3. Add 4 Empty_Sprite_Obj intances total, and you get an out of bounds error.
Download at
https://www.dropbox.com/s/p551bpgaolizoio/Tilemap Error.yyz?dl=0
Images below contain some extra variables before I narrowed down where things were going wrong, The tilemap names, and ids are the problem in the images.
Is this a bug, or is there something I can do to fix it in my game, and if so what? If it is a bug is there any workaround?
Last edited: