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

[SOLVED]Pause Menu Help

B

bobula13

Guest
Hey all,

I've been going through the tutorial that Heartbeast made for a pause menu, saving and loading. All of the functions work just fine except for one major thing.

When the game is paused and then unpaused you can tell that the enemies set in the room were still moving around, like they will be right up against the player character.

The other issue I have is that when the pause menu is on (which is just a simple black screen with white text) the enemies in the room are roaming all over the screen. I have gone over, and over the code and cannot find any discrepancies that would cause this issue.

Any help anyone can give would be appreciated.

Thanks
 
N

Nickh90

Guest
I could share my code for my pausemenu that has clickable buttons you could assign to save the game and load it with if you're interested. Its pretty simple.


Edit: here it is.pausemenu.gmz
it should be simple to create load/save buttons aswell.
I've explained Everything in comments. If I missed something or you don't understand just reply.
 
Last edited by a moderator:
M

Maximus

Guest
If your pause screen is just a black screen that doesn't show whats going on the the room, you could deactivate all your objects then reactivate on unpause. this will stop there code running, basically freezing them in time untill they are reactivated.

Code:
instance_deactivate_all(notme)
instance_activate_all()
physics_pause_enable(flag)
https://docs.yoyogames.com/source/dadiospice/002_reference/objects and instances/instances/deactivating instances/index.html

I have this in the escape key pressed event in my menu object for one project:
Code:
if paused
{
    paused = false;
    instance_activate_all();
}
else
{
    paused = true;
    select = menu.continue;
    instance_deactivate_all(true); // putting true in the argument here keeps the current instance* active
}
 
Last edited by a moderator:
N

Nickh90

Guest
Heres and Updated version of that menu I felt like fixing the Else if statements and did as Maximus suggested which was to use Enums and a switch statement Link Here: pausemenu.gmz
 
B

bobula13

Guest
Thanks for all the help, I really appreciate it. I ended up using a different menu system where the pause menu is in an object instead of a room and everything is deactivated. The only problem I'm having now is that with my new menu, which is set as an object, has it's own draw_gui event. In the event I set a different font with a different color so it would be easier to read while I'm working on things. What happens is that the font in the GUI I have for the player's stats changes to the menus font. I've tried looking this up before, and done what I can to fix it on my own, but for whatever reason I can't get it to work.
 
M

Maximus

Guest
Thanks for all the help, I really appreciate it. I ended up using a different menu system where the pause menu is in an object instead of a room and everything is deactivated. The only problem I'm having now is that with my new menu, which is set as an object, has it's own draw_gui event. In the event I set a different font with a different color so it would be easier to read while I'm working on things. What happens is that the font in the GUI I have for the player's stats changes to the menus font. I've tried looking this up before, and done what I can to fix it on my own, but for whatever reason I can't get it to work.
just put draw_set_font before drawing any text so you're always using the intended font.
 
B

bobula13

Guest
Well, after all of this I figured out what I did wrong. I was having enemies duplicate themselves in each room that I had created, including the room I created for the pause menu (when I used the heartbeast tutorial). I had a parent lifeform for each creature and they were both set to persistent. Soon as I unchecked the persistent on the individual enemies the pause started working correctly and the enemies quit duplicating. Thanks again for everyone's help, I hate being a noob but what can you do.
 
Top