GMS 2 [Solved]Tilemap_set() errors

Discussion in 'Programming' started by The Video Gamester, Jan 10, 2019.

  1. The Video Gamester

    The Video Gamester Member

    Dec 2, 2016
    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.

    for(yy = 0; yy<height; yy++){
        for(var xx = 0; xx < width; xx++){
            if(grid[# xx, yy] == FLOOR){
                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){
                    filled = true;
            }else if(grid[# xx,yy] == WALL){
  2. rIKmAN

    rIKmAN Member

    Sep 6, 2016
    The error "tilemap_set() - couldn't find specified tilemap" should point you to the problem.

    What is "backgroundLayer"?
    If it's not the tilemap element id returned when using layer_tilemap_create() or layer_tilemap_get_id() then that's your problem - as per the manual entry for tilemap_set().
  3. The Video Gamester

    The Video Gamester Member

    Dec 2, 2016
    I figured it out. I honestly have no idea why it was working at all. It would work 100% without the spawn code but the spawn code isn't directly related. I just changed a couple of vars that I was passing in and now it works. Weirdest problem I have ever had.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice