我正在使用 libgdx 并且我有几个具有不同方法的游戏对象我希望我的计时器中的方法一个接一个地发生但是在 libgdx 它们一次发生我不知道如何修复它
timer.scheduleTask( task = new Task(){ public void run(){
rando =rn.nextInt(8);
Gdx.app.log("the num is", Integer.toString(rando));
if(rando == 0){
bush.rustle();
bush2.rustle2();
bush3.dontrustle3();
bush4.dontrustle4();
enemy.shoot();
enemy2.shoot();
enemy3.godown();
enemy4.godown();
}
if(rando == 1){
bush.dontrustle();
bush2.rustle2();
bush3.rustle3();
bush4.dontrustle4();
enemy.godown();
enemy2.shoot();
enemy3.shoot();
enemy4.godown();
}
if(rando == 2){
bush.rustle();
bush2.dontrustle2();
bush3.rustle3();
bush4.rustle4();
enemy2.godown();
enemy.shoot();
enemy4.shoot();
enemy3.shoot();
}
if(rando == 3){
bush.rustle();
bush2.rustle2();
bush3.rustle3();
bush4.rustle4();
enemy.shoot();
enemy2.goup();
enemy4.goup();
enemy3.shoot();
}
if(rando == 4){
bush.rustle();
bush2.rustle2();
bush3.rustle3();
bush4.rustle4();
enemy2.godown();
enemy.godown();
enemy4.shoot();
enemy3.shoot();
}
它的工作原理是每次调用一个数字时都会运行一组方法,但它们会同时运行,我希望它们一个接一个地运行