Lets say I want to make a loop or something that prints out, for example, \"Mario\" every second. How can I do this? Can\'t seem to find any good tutorials that teach this a
I used the TimeUtils of libgdx to change my splashscreen after 1.5 seconds. The code was something like this:
initialize:
long startTime = 0;
in create method:
startTime = TimeUtils.nanoTime();
returns the current value of the system timer, in nanoseconds.
in update, or render method:
if (TimeUtils.timeSinceNanos(startTime) > 1000000000) {
// if time passed since the time you set startTime at is more than 1 second
//your code here
//also you can set the new startTime
//so this block will execute every one second
startTime = TimeUtils.nanoTime();
}
For some reason my solution seemes more elegant to me that those offered here :)