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

global mouse release taking over mouse left release

N

nessabby1

Guest
I have a bit of an issue. I have a pause button that if you mouse left release, then the game will pause. I dont want the player have to mouse left click that same spot to unpause the game, once the pause screen pops up, at this point i want the player to be able to click anywhere on the screen to resume. I have made a event global mouse left release but apparently that is interfering with the first mouse left release event.
This is the code for the mouse left release it works perfectly fine :
if (global.pause ==0)
{
global.pause=1;
}
else
{
global.pause=0;
}

until i tried to add the global mouse left released event. it just uses the global mouse left released event rather than the normal mouse left release event in game session and if thats the case, then why do i need an actual pause Sprite. I dont want this be.
 
So what I think is happening is that your code is fine. However, since you have both a Mouse Left Released event and a Global Mouse Left Released event, they both activate on the same step whenever you release the left mouse button. Meaning, the first event sets global.pause to true, then immediately the second event sets it to false.

I would get rid of the Mouse Left Released event completely, and merge the code into the Global Mouse Left Released event. With code it would look something like this:
Global Left Released Event
Code:
if (!global.pause && instance_position(mouse_x, mouse_y, id))
{
//we aren't paused yet and have just clicked the pause button, so pause the game
global.pause= true;
}
else if (global.pause)
{
//we are paused and have clicked anywhere on the screen, so unpause the game
global.pause= false;
}
 
N

nessabby1

Guest
So what I think is happening is that your code is fine. However, since you have both a Mouse Left Released event and a Global Mouse Left Released event, they both activate on the same step whenever you release the left mouse button. Meaning, the first event sets global.pause to true, then immediately the second event sets it to false.

I would get rid of the Mouse Left Released event completely, and merge the code into the Global Mouse Left Released event. With code it would look something like this:
Global Left Released Event
Code:
if (!global.pause && instance_position(mouse_x, mouse_y, id))
{
//we aren't paused yet and have just clicked the pause button, so pause the game
global.pause= true;
}
else if (global.pause)
{
//we are paused and have clicked anywhere on the screen, so unpause the game
global.pause= false;
}
wow thanks so much it worked
 
Top