• 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 - Don't want alarm to reset.

Y

yoop

Guest
I have a game that I need to set an alarm after clicking, so in my click event I set an alarm and it would count to then I would be able to move again, but if i try to click while the alarm is running it just sets it again, I want it to set then not be able to be reset until I can move again.
 

jo-thijs

Member
So, first check if alarm[...] >= 0 before setting the alarm.

EDIT:
And I just noticed that you've already asked this question in an other topic.
In the future, please be more patient.
 
Y

yoop

Guest
So, first check if alarm[...] >= 0 before setting the alarm.

EDIT:
And I just noticed that you've already asked this question in an other topic.
In the future, please be more patient.
Sorry I will try to be. Okay so I've done that and it still doesnt seem to work
Code:
if(alarm[0] >= 0) {
    alarm[0] = 30;
}
 

Electros

Member
You can do this with a tracking variable of some sort if you like.

So in creation code, have a variable e.g.

Code:
clickable = true;
In the click code:

Code:
if(clickable == true)
{
alarm[0] = 30;
clickable = false;
}
And then within the alarm:

Code:
clickable = true;
To enable the user to click again.
 
T

TimothyAllen

Guest
He actually meant that if the alarm is >= 0 then it's already been set because alarms sit at -1 when idle. So:
Code:
if (alarm[0] < 0)
{
    alarm[0] = 30;
}
 
Top