There is another way, i use it on a game with scrollable view cameras and even text messages or enemy fireballs stop in their tracks and continue when unpaused, it works great
i do it with 2 objects pause and unpause, ill explain how i implemented them and show which events to put the code
ill explain a fixed room size and tiled scrollable also
ill refer to level room as the game room to be paused
make a pause room with nothing in it, persistant objects will carry over to the pause room so try not to use them especially like player
make the room size the same as your level room if it is the screen size, if it is bigger for scrolling make the room size the camera or veiwport size
make a pause object and put it in the level room
make an unpause object and put it in the pause room, mine is rm_pause
the pause object
make 3 events create,key press P and key up P ...this is just the way i coded it but try only call it once and not in a step event
** in create event of pause object:
global.Paused = false;
global.Paused_room = room;
global.OldScreen = -1;
** in key press P event: (or any key you want for pausing)
global.Paused = true;
if(!(surface_exists(global.OldScreen)))
{
global.OldScreen = surface_create(camera_get_view_width(view_camera[0]), camera_get_view_height(view_camera[0]));
view_surface_id[0] = global.OldScreen;
}
**in the key up P event
room_goto(rm_pause);
**************************************************
the unpause object
make 4 events create, draw_gui, key press P and key up P
** in create event of unpause object:
view_surface_id[0] = global.OldScreen;
** in key press P event: (or any key you want for unpausing)
global.Paused = false;
**in the key up P event:
surface_free(global.OldScreen);
room_goto(global.Paused_room);
**in the DrawGui event:
if(surface_exists(global.OldScreen))
{
draw_surface_stretched(global.OldScreen, 0, 0, display_get_gui_width(), display_get_gui_height());
// This is all that is really necessary
// Implement anything you want to draw here like so
draw_set_colour(c_yellow);
draw_set_halign(fa_center);
draw_set_valign(fa_top);
draw_text_transformed(display_get_gui_width()/2, display_get_gui_height()/2, string("PAUSED") + "", 4, 4, 0);
}
Thats it, make sure that you put the pause object in the room you want to pause and the unpause object in the pause(rm_pause) room
This way you don't need to deactivate an instance unless it is persistant and visible in multiple rooms or need to check every instance if it is paused enjoy
You can also do whatever to the surface in the pause room animate it or use a shader because it will be destroyed when you exit the pause room
if you can't get it to work i can put the 2 objects in a dropbox