K
Kamon145
Guest
Hi everyone, this is less of a programming issue and more of a "does the way Im doing this seem efficient and make sense" kind of question. Hope this is still the proper forum for it, anyways I have a countdown timer in my game and I want it to stay very accurate even at long times and times where game rate may slow. I am using the current time to do this in the following manner
This seems to work well, however I've only used it in a small test project so far so I'm not sure how it will act in the long run.. Does anyone see any potential bugs in doing things this way? if the game lags just right is everything gonna get thrown off?
Code:
//Create Event :
cur_sec = current_second;
global.minutes = 2;
global.seconds = 60;
timer_start = false;
//Step Event
//This line is just for testing to start the timer right at the beginning of a minute
if current_second == 0 && timer_on == false
timer_on = true
if timer_on = true
{
if current_second > cur_sec
{
cur_sec = current_second;
global.seconds -= 1;
}
else
if current_second == 0 && cur_sec != 0
{
cur_sec = 0
global.seconds = 59;
global.minutes -=1;
}
}