libGDX How to do a scrollable Home screen

1k Views Asked by At

I whant to get my home screen to be scrollable to left and right. I use scene2d and it should be like: Credits screen / Singleplayer screen / Multiplayer screen / Options...

I know how to handle Input don't explain this...

Questions:

  1. Schould i use for every screen a different Stage?
  2. Does it have somting to do with Viewport?
  3. If the home screen gets called does it take long to initialise the stage/s
  4. If 3 is true, how can i load the while an splash screen is displaying?
1

There are 1 best solutions below

1
On

To answer your questions:

  1. You can, but then the hard part will be a smooth transition between them.
  2. If you only use one stage, you could use the viewport for the scroll animation. I would suggest you to use a ScrollPane though (see example below).
  3. If you don't mess up the implementation, it does not take long.
  4. I suggest you to look at the AssetManager: https://github.com/libgdx/libgdx/wiki/Managing-your-assets

As you can see, there are multiple ways to get such a scrolling screen. I have personal experience using the ScrollPane to achieve this solution. See: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/ScrollPane.html and http://nexsoftware.net/wp/2013/05/09/libgdx-making-a-paged-level-selection-screen/