It really depends on what your game is like. I think the most straightforward way is to deactivate instances. You can save the current image to a surface and display that if you would like. Both of these things can be accomplished with a few lines of code and is very stable which is why I prefer it. However, it doesn't work if you need elements of your game world to run in the background. In this case, there's really no way around building a 'paused' state into every object that needs to be paused.
Here is the basic deactivate instances idea - when you want to pause create a pause object with the following code and when you want to unpause destroy that object:
Code:
/// Create Event of Pause Object
instance_deactivate_all(true);
...reactivate the objects you need active if any
/// Destroy Event of Pause Object
instance_activate_all();
I generally have objects that should be paused as part of a controller class and then I do this:
Code:
/// Create Event of Pause Object
instance_deactivate_all(true);
instance_activate_object(controller_parent);
/// Destroy Event of Pause Object
instance_activate_all();
If you want to build a pause state into objects, then I would do it with user events. Then when you want to pause you can do this:
Code:
//pause
with (all) {
event_user(0);
}
//unpause
with (all) {
event_user(1);
}
The reason this is nice is that you can call event_user even if that event doesn't exist and the event will be specific to that object meaning that you can control how each object pauses (by giving them their own user event) and whether they pause at all (by not giving them those user events). What the code to pause would look like depends entirely on what your code already looks like.