• 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!

Pause the game if the player "exits" it

Hi there! Our game "RETURN" has grown a little bit since we last posted anything. We now have a pause menu, and many other things. It actually works moving to another room and creating an object that can be controled by the user.

As the game will be fullscreen all the time, the player can exit it by pressing the windows key, but the game continues even though he's no longer using the program. What we wanna do is whenever the player exits the game (but the program is still running; it appears in the taskbar) it moves to the pause room.

Is there any way to do that? We don't event know what to check for... Thank you in advance!
 
Code:
if !window_has_focus()
{
    if room != rm_paus_room room_goto(rm_paus_room);
}
Maybe something like this.
Yeah! That worked perfectly!! We only had to change our pause system; we had if ("you are pressing the pause button") { [...] }, so we have put an or operator and an and inside;
Code:
if ((keyboard_check_pressed(vk_escape)) or (!window_has_focus() and room!= rm_pause)) {

// Big code here!!

}
 
Top