LibGDX delay for several seconds

I have an application in which I would like to pause a little. It would be important that graphic elements / changes are better visible between two automatic interactions.

I tried to use the above code for 2 minutes pause, but it causes a pause at the beginning of the method, and not between two exact lines of code inside the method.

try {
    Thread.sleep(2000);
} catch(InterruptedException ex) {
    Thread.currentThread().interrupt();
}
+4
source share
1 answer

Libgdx , ( ) . , "" , . , , ..

, , . ? ? .

long endPauseTime = 0;

, :

endPauseTime = System.currentTimeMillis() + (2 * 1000); // 2 seconds in the future

:

if (endPauseTime < System.currentTimeMillis()) {
   // non-paused mode, so check inputs or whatever
} else {
   // paused mode, so skip some things ..
}
+2

All Articles