#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