Need help getting my animation to play before while loop
Ok, so here's my problem, I'm currently trying to play an animation for my program then create a .5s gap between it and the next animation that plays: (this is just one of the snipets, but the next few are very similar, just with mbtnTwo.startAnimation();, mp2.start(); etc.)
Code java:
if (gamenum2 == 1) {
mbtnOne.startAnimation(animAlpha);
mp.start();
start = System.currentTimeMillis();
while (System.currentTimeMillis() < (start + 500)) {
;
}
mbtnOne.clearAnimation();
}
It works for the most part, the sound effect from "mp.start();" plays then waits for the the while loop to finish (the .5s pause) before moving on to the next part "mp2.start()", but the animation won't play until it goes through all the numbers. Once all the sounds play (its gone through the whole program) it will start all the animations at the same time.
Re: Need help getting my animation to play before while loop
Another approach:
Have the first animation use a Timer that waits the duration before starting the next animation.
Burning a hole in memory by looping seems a waste.