我想要一个动画启动画面,如淡入淡出,我正在使用如下调整大小方法进行处理
public class SplashScreen extends GamePlayScreen {
@Override
public void resize(int width, int height) {
super.resize(width, height);
stage.clear();
Drawable splashDrawable = new TextureRegionDrawable(region);
splashImage = new Image(splashDrawable, Scaling.stretch);
splashImage.setFillParent(true);
splashImage.getColor().a = 0f;
splashImage.addAction(Actions.sequence(Actions.fadeIn(0.75f),
Actions.delay(1.75f), Actions.fadeOut(0.75f),
new Action() {
@Override
public boolean act(float delta) {
// the last action will move to the next screen
System.out.println("moving to next screen");
splashGameObj.setScreen(new GamePlayScreen(
splashGameObj));
return true;
}
}));
stage.addActor(splashImage);
}
}
最佳答案
尝试将您的 new Action()
更改为 new RunnableAction(){ public void run(){....
。
这里有更多的 Action ,还有一些其他的解释它们是如何工作的。引用另一个问题。
->Actions
另请看:
screen2D, libgdx wiki about actions
关于android - libgdx 中的 scene2D - 动画不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15987059/