java - LibGDX Timer doesn't start after game resumed on android -
i'm creating 2 timers in code. 1 logic timer updates logic every 0.017 seconds:
logictimer = new timer(); logictimer.scheduletask(new timer.task() { @override public void run() { updatelogic(); } }, 0f, timeperprocessing);
and other 1 generating obstacles every 3 seconds:
meteoroidtimer = new timer(); meteoroidtimer.scheduletask(new timer.task() { @override public void run() { generatemeteoroids(); } },1f,3f);
when pause game , resume afterwards, logic timer still works obstacle timer doesn't. thought because use random object in method call in timer, tried simple:
system.out.println("it showing");
and still doesn't resume.
my code pause , resume:
@override public void pause(){ meteoroidtimer.stop(); logictimer.stop(); } @override public void resume(){ meteoroidtimer.start(); logictimer.start(); }
you dont need use timer.stop , star on resume because when leave app libgdx stops rendering/updating anyway timers wont updated anyway.
Comments
Post a Comment