The Video Gamester
Member
So I had this working perfectly a few days ago but after I split this into a separate script it totally screwed it up. Basically I have it set so when I press space it generates a whole new level. Previously it would generate an entire new level and tile it just fine. Now it spawns the enemies but doesn't tile when I restart the room. I get an error in the output window that says
I am so confused. I have tried basically everything I can think of. I put it back into the original body and it still causes the same issue. I have tried changing the enemy to a blank object with no code. Changed it to game restart rather than room. Rewrote the code in another script. Nothing is working and its driving me nuts.tilemap_set() - couldn't find specified tilemap
Code:
for(yy = 0; yy<height; yy++){
for(var xx = 0; xx < width; xx++){
if(grid[# xx, yy] == FLOOR){
tilemap_set(backgroundLayer,2,xx,yy);
var odds = 5;
var ex = xx*cellWidth+cellWidth/2
var ey = yy*cellHeight+cellHeight/2
var filled = false;
odds = 5;
if(!filled && irandom(odds) == odds){
instance_create_depth(ex,ey,1,obj_enemy)
filled = true;
}
}else if(grid[# xx,yy] == WALL){
tilemap_set(backgroundLayer,1,xx,yy);
mp_grid_add_cell(gridPath,xx,yy)
}
}