- Code: Select all
Time currentTime = new Time();
currentTime.setToNow();
int milliDiff = (int) (currentTime.toMillis(false) - startTime.toMillis(false));
if(milliDiff > 1000) {
startTime.setToNow();
sec--; // in class scope to count # seconds
millis = milliDiff;
if(sec < 0) {
sec = 0;
} else if (sec < 10) {
Assets.tick.play(100);
}
}
The display code is elsewhere, and the FPS < 1 second. If I set the value of milliDiff to 500, then it seems to run at close to the proper speed.
I know there are other approaches to this problem, but can anyone explain why this fails?
Thanks.

