T
The Shatner
Guest
Here's the thing: I am adding a timer to my game, and I am having trouble with the fact that some hardware can be somewhat laggy, and the timer gets easily out of sync with the real world.
I've started working on the issue as follows:
----------------------------------------------------
CREATE EVENT:
ct_control_ini = current_time;
STEP EVENT:
ct_control = current_time - ct_control_ini;
centisecond = (ct_control*0.1);
if (centisecond >= 100) {
second ++;
ct_control_ini = current_time;
}
if (second = 60) {
minute ++;
second = 0;
}
----------------------------------------------------
That kinda worked, but I read about the legendary 'delta_time', and that it could be exactly what I need to fix the clock perfectly. However, I couldn't find any examples of delta_time used for precise time displaying, only to help fix the 'speed' of a given object. Since I am a beginner at the whole programming thing, I am having trouble to understand how can I use delta_time to fix my timer. Can anyone give me some advice?
I've started working on the issue as follows:
----------------------------------------------------
CREATE EVENT:
ct_control_ini = current_time;
STEP EVENT:
ct_control = current_time - ct_control_ini;
centisecond = (ct_control*0.1);
if (centisecond >= 100) {
second ++;
ct_control_ini = current_time;
}
if (second = 60) {
minute ++;
second = 0;
}
----------------------------------------------------
That kinda worked, but I read about the legendary 'delta_time', and that it could be exactly what I need to fix the clock perfectly. However, I couldn't find any examples of delta_time used for precise time displaying, only to help fix the 'speed' of a given object. Since I am a beginner at the whole programming thing, I am having trouble to understand how can I use delta_time to fix my timer. Can anyone give me some advice?