Search code examples
androidlibgdx

Libgdx sliding screen transition


I have a libgdx project with a Game as the base class and two Screens (my menu screen and my splash screen). I want, when the splash screen has finished, to slide the splash screen to the right and put the menu screen. I can just make an instant transfer using:

game.setScreen(new MainMenu(game));

but that dosen't include the sliding transition between the screens. I cannot find any website that tells me how to do this, how could I? I also have universal tween engine, by the way.


Solution

  • As Saeed said u can use the TweenEngine to make simple screen transisitons. Here is a Tutorial

    If you need some complex transitions like sliding and slicing, you can take a look at a frame buffers and implement it your own way. The core thing is to swap between 2 frame buffers. While the transition is running render the two screens in a single frame buffer and then blend between them in the final rendering step. With this solution you are very flexible, but it takes more work and you can get in trouble, when using box2dlights.

    I consider writing a small tutorial and update this post with it.

    I suggest the Book: Learning Libgdx Game Development.

    Edit: https://github.com/digital-thinking/libgdx-transitions