How to pause and unpause a match 3 game?

Can someone please tell me how I could pause and unpause the game I am working on?
So far I created an object named pause_button that when pressed displays a small pause screen. The pause screen should contain a button that closes the pause screen when pressed.
here is the code I have so far:
Object pause_button --> Events: -Create:
GML:
mid_point=room_width/2;
start_point=mid_point-155;
bar_Ypos=120;
global.enable_pause=false;
-Left pressed:
Code:
global.enable_pause=true;
Object pause_screen --> Events: -Create:
GML:
mid_point=room_width/2;

start_point=mid_point-155;

bar_Ypos=120;
-Draw:
GML:
if (global.enable_pause==true)
{
busy=true;
draw_sprite(sp_grey_bkg,0,mid_point+1,bar_Ypos+382);
draw_sprite(sp_pause_menu,0,mid_point,bar_Ypos+350);
draw_sprite(sp_continue,0,mid_point,bar_Ypos+290);
-Left pressed:
GML:
busy=false;
global.enable_pause=false;

The problem I am having is that I can't add an unpause button to the pause screen. All I can do is add a sprite that doesn't do anything when clicked.
 

Attachments

Ommn

Member
use "global left pressed" event
and use this code:
GML:
if point_in_rectangle(mouse_x,mouse_y,mid_point-sprite_get_width(sp_continue)/2,bar_Ypos+290-sprite_get_height(sp_continue)/2,mid_point+sprite_get_width(sp_continue)/2,bar_Ypos+290+sprite_get_height(sp_continue)/2)
{
    busy=false;
    global.enable_pause=false;
}
 
use "global left pressed" event
and use this code:
GML:
if point_in_rectangle(mouse_x,mouse_y,mid_point-sprite_get_width(sp_continue)/2,bar_Ypos+290-sprite_get_height(sp_continue)/2,mid_point+sprite_get_width(sp_continue)/2,bar_Ypos+290+sprite_get_height(sp_continue)/2)
{
    busy=false;
    global.enable_pause=false;
}
I works, thank you so much.šŸ˜ƒ
 
Top