• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

SOLVED Code Logic Error?

I have a small block of code that isn't executing. If I remove the check: if (global.lastLevel == 2) it executes. I do a test debug message statement before the code:

GML:
    show_debug_message("Passed Ex mouse check button");
    show_debug_message("lastLEvel value check is " +  string(global.lastLevel));
    if (global.lastLevel == 2)
The debug statement prints out 2 like it is supposed to. This has me puzzled.

Code:
//CLICK ON TO ENTER LEVEL
/*!!!!!!!!!!!!!*/
//Grasslands
if (mouse_check_button_released(mb_left))
{
    
    //Forest of Anguish
    if mouse_x < 390 && mouse_x > 340  && mouse_y > 320  && mouse_y < 370
    {
        if global.lastLevel == 1
        {
            global.completed_level1 = true
            global.lastLevel = 2
            show_debug_message("lastLevel value is " + string(global.lastLevel));
            global.game_map = 7;
            room_goto(SecondLevel)
        }
        
    }
}
        
//go to level 3
//Avalanche
if (mouse_check_button_released(mb_left))
{
    show_debug_message("Passed Ex mouse check button");
    show_debug_message("lastLEvel value check is " +  string(global.lastLevel));
    if (global.lastLevel == 2)
    {
        if mouse_x < 580 && mouse_x > 515  && mouse_y > 289  && mouse_y < 337
        {
            show_debug_message("Passed border lines Ex")
            //global.game_map = 6;
            global.completed_level2 = true
            global.game_map = 20;
            global.lastLevel = 3
            room_goto(ThirdLevel)
        }
    }
}
 
Looks like the coordinates are different:

Mouse coordinates: 369 356 (x, y)

Now why is the question. It is displaying something different on screen.
 
The Y coordinate is probably right but one of the x coordinates is off. I don't know which are right, the ones reported by show_debug_message or the ones reported on screen, neither work properly. The show_debug_message coorvdinates launch the second level into the third level and the on screen coordinates don't do anything at all for the snow level (thirrd level)
 
Top