O
oziphantom
Guest
I'm adding/setting tiles in the 'creation code' for a room like so
But nothing shows up, I just get a grey game window. If I go into the debugger, get the debugger to play ball, then "Restart" in the debugger it works. Which makes me think that room0 is correct, its just not assigned at the time of the creation script is called.
I've tried self, but that seems to be null also ( although the debugger calls everything <unknown> so don't really know ). I've tried 0 as a number as that is what I would expect an 'index' to be, same result. I've tried the name 'level1' that gets me an error telling me that no variable with that name exists. So it knows what room0 is at least.
The help file has
which doesn't help very much as I'm not making one in code. But i did try global.rm which is not defined and it crashes.
goolging for this function or, room creation script has yielded me nothing.
so what do I put as the index for room_tile_add in the create script?
GML:
var iy,ix,tileNum,tx,ty,px,py;
for (iy=0; iy < gMapHeightTiles ; iy++)
{
for(ix=0; ix < gMapWidthTiles ; ix++)
{
tileNum = file_bin_read_byte(tileMapFile);
px = ix * gMapTilePixelWidth;
py = iy * gMapTilePixelHeight;
tx = (tileNum % gBackTilesTileXCount) * gMapTilePixelWidth;
ty = floor(tileNum / gBackTilesTileXCount) * gMapTilePixelHeight;
show_debug_message("tileNum = "+string(tileNum)+" px = "+string(px)+" py = "+string(py)+" tx = "+string(tx)+" ty = "+string(ty));
room_tile_add(room0,backTiles, tx, ty, gMapTilePixelWidth, gMapTilePixelHeight, px, py, 1);
}
}
I've tried self, but that seems to be null also ( although the debugger calls everything <unknown> so don't really know ). I've tried 0 as a number as that is what I would expect an 'index' to be, same result. I've tried the name 'level1' that gets me an error telling me that no variable with that name exists. So it knows what room0 is at least.
The help file has
Code:
global.rm = room_add();
room_assign(rm_Base, global.rm);
room_tile_add(global.rm, tl_grass, 0, 0, 256, 32, 0, 400, 10000);
goolging for this function or, room creation script has yielded me nothing.
so what do I put as the index for room_tile_add in the create script?