Daniel Mallett
Member
I'm convinced this is a bug.
case const_level_type_jungle:
{
lay_id = layer_get_id("lyr_front_tile");
tile_id = layer_tilemap_get_id(lay_id);
tilemap_tileset(tile_id, tl_jungle_front);
lay_id = layer_get_id("lyr_back_tile");
tile_id = layer_tilemap_get_id(lay_id);
tilemap_tileset(tile_id, tl_jungle_back);
lay_id = layer_get_id("lyr_background_tile");
tile_id = layer_tilemap_get_id(lay_id);
tilemap_tileset(tile_id, noone);
break;
}
The code above changes the current tileset. Great works no problem. This is only if a tileset has been added within the IDE. It doesn't matter what it is as long as it's set at runtime you can change it. But if you start with nothing you will never be able to apply a tileset.
Is there an extra line of code needed to apply a tileset to a null value. I don't know why this is happening but my best guess would be the compiler says oh there is nothing in there at runtime so I won't bother at all. The same way as if you reference a variable only once it will not be compiled.
I guess it's not a problem when you know that is what happens. If you don't know, very frustrating because you look through your code and hit a brick wall because ultimately there is nothing wrong with the code per se.
case const_level_type_jungle:
{
lay_id = layer_get_id("lyr_front_tile");
tile_id = layer_tilemap_get_id(lay_id);
tilemap_tileset(tile_id, tl_jungle_front);
lay_id = layer_get_id("lyr_back_tile");
tile_id = layer_tilemap_get_id(lay_id);
tilemap_tileset(tile_id, tl_jungle_back);
lay_id = layer_get_id("lyr_background_tile");
tile_id = layer_tilemap_get_id(lay_id);
tilemap_tileset(tile_id, noone);
break;
}
The code above changes the current tileset. Great works no problem. This is only if a tileset has been added within the IDE. It doesn't matter what it is as long as it's set at runtime you can change it. But if you start with nothing you will never be able to apply a tileset.
Is there an extra line of code needed to apply a tileset to a null value. I don't know why this is happening but my best guess would be the compiler says oh there is nothing in there at runtime so I won't bother at all. The same way as if you reference a variable only once it will not be compiled.
I guess it's not a problem when you know that is what happens. If you don't know, very frustrating because you look through your code and hit a brick wall because ultimately there is nothing wrong with the code per se.