SOLVED Pause menu doesn't work

Ham

Member
GML:
if(keyboard_check_pressed(vk_escape)){
    global.pause = !global.pause;
    if(global.pause){
        instance_deactivate_all(true);
        layer_hspeed("Background",0);
        screenshot = sprite_create_from_surface(application_surface,0,0,view_wport,view_hport,0,0,0,0);
    }else{
        if(screenshot!=-1){
            sprite_delete(screenshot);
            screenshot = -1;
        }
        instance_activate_all();
        layer_hspeed("Background",-1.5);
    }
}
if(global.pause==false){
    global.time++;
}else{
    draw_sprite_ext(screenshot,0,0,0,1,1,0,0,1);
}

draw_text(20,20,global.pause);
this is the code I'm currently using to pause the game and take a screenshot to display, but for some reason, as soon as the game is paused, it doesn't ever draw the screenshot properly
1613722500184.png
this is how the game is unpaused
1613722527917.png
and paused it looks like this.

Any and all help is appreaciated
 

woods

Member
shot in the dark...

are you taking a screenshot of the room with everything deactivated?
instance_deactivate_all
then
screenshot=
 
Why would you need to screenshot the screen? That's generally not how pause screens work. They just halt the main game loop and keep the drawing as normal. A bunch of games I've played (even mario 64) forget to stop particles from updating, so you'll see them move while everything else is staying still.
 
Top