GMS 2 Pause Button

Kealor

Member
Generally the two main methods are marking an entire room as persistent then switching to another "pause" room and the other is simply making all entities in the room deactivated ("instance_deactivate(all)") then reactivating the stuff you want to keep (data caches, managers etc.).

I recommend the latter, either way what you'll need to do is get a screen-cap of the game and draw it behind your menu, if you are going for the classic darkening of the room with buttons/text etc overlayed.

I can go into more detail if you want, though i think there are some tutorials on this out there as well.
 
There are lots of ways to pause a game.
You can look up a few tutorials if you want to become familiar with the idea of pausing, and then create your own.
I will say that pausing the game and it's entirety is somewhat difficult, depending on how you'd like to pause the game.
It's best to implement the pause feature early in development so everything else can be incorporated into the feature.

Two most common ways I've seen are:
  • Sending the player to a new room as the pause screen.
  • Telling the objects on the screen to either Exit in the Step event or become disabled though means of custom variables.
Here is an example of one way to create a pause feature.
 
from looking at these posts i have created my own simple pause screen. and it can be done in D&D! (note: may have some bugs but it does a simple experimental job.) make an object used for pausing. when you hit the desired button you choose, drag the save game function and name your file(anything you want, ie. pause), then drag "go to specific room" and create a room for a pause screen(just make a sprite with a pause screen design and put it on an object.). next make a second object that loads the saved file by dragging "load game". it will take you back to where the game was last saved, ie. when you hit the pause button. (one final note: dont use the same button for pause and unpause. [due to how my game's set up anyway,] when you keep hitting the same button in quick succession, it may crash the game depending on whats going on in the game you're saving. two seperate buttons for pause/unpause so far seems to work) if anyone tries this and has troubles with it working please let me know. i literally just figured this trick out today and wanted to share it.



(edit: im have some problems with a few objects not working right and some objects having their order on their instance layer get moved around. i might just need to change things but like i said its an experimental idea for a pause button. maybe you guys can make it work better)
 
Last edited:
Top