How can I make transition between stages in libgdx ?
I have 2 screens MenuScreen and GameScreen each of which has a stage
I write the following to make a transition :
in MenuScreen
SequenceAction sequenceAction = new SequenceAction();
sequenceAction.addAction(Actions.moveTo(-Gdx.graphics.getWidth(), 0, 4.0f));
sequenceAction.addAction(Actions.run(new Runnable() {
@Override
public void run() {
gameMain.setScreen(new GameScreen(gameMain));
}
}));
stage.getRoot().addAction(sequenceAction);
in GameScreen
stage.getRoot().setPosition(Gdx.graphics.getWidth(), 0);
stage.getRoot().addAction(Actions.moveTo(0, 0, 4.0f));
but the problem is GameScreen does not following MenuScreen directly i.e it wait until MenuScreen has completely gone from screen and I want them to move at the same time