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

Legacy GM How do I prevent pause menu from appearing during the title screen? [SOLVED in 3 minutes!]

pixeltroid

Member
So I just discovered that my pause menu appears in the title screen if I press escape. This obviously shouldnt happen but I dont know what to do.

My title screen rooms names are "room_start" and "room_story". I dont want the player to summon the pause menu in those rooms.
How do I make it so that the pause screen cannot be created in those rooms??

Here's the code for the pause object:

Create:
Code:
pause = 0
Draw:
Code:
if (pause)
{
    draw_set_color(c_black)
    draw_rectangle(0,0,room_width,room_height,0);
    draw_set_halign(fa_center)
    draw_set_font(fnt_small)
    draw_set_color(c_white)
    draw_text(view_xview + view_wview/2, view_yview + view_hview/2, "GAME PAUSED");
    draw_set_color(c_black)
}
Press "escape"
Code:
if (! pause)
{
    pause = 1
    instance_deactivate_all(true);
   instance_create(view_xview+128,view_yview+144,obj_pausemenu)
}
else
{
pause = 0;
instance_activate_all();
with (obj_pausemenu) {instance_destroy();}
}
Is there a way to modify this code so as to prevent the pause menu from appearing in "room_start" and "room_story" ??

Any help would be appreciated!
 

trg601

Member
The current room is stored in the variable room in gamemaker so you can check if the current room is one of those two rooms in the press escape event like so:
Code:
if (room != room_start && room != room_story)
{
    if (! pause)
    {
         ...
}
 

pixeltroid

Member
The current room is stored in the variable room in gamemaker so you can check if the current room is one of those two rooms in the press escape event like so:
Code:
if (room != room_start && room != room_story)
{
    if (! pause)
    {
         ...
}
Thanks!!! it worked.
 
Top