Question

I´m have a question about LibGDX Game Engine.

  1. Im always use SpriteBatch to draw on screen, now I will make the same game menu like Flappy Bird. In Flappy Bird the menu comes into the game screen, so flappy bird don´t have more screens, he take it all on the same screen. Can i do this with a stage and scene2D or can i use SpriteBatch for this?
  2. On Stage I can use actions to rotate my textures, is that doable with SpriteBatch too?

Hope you can help me, sorry for my bad english :)

Greetings coco07 ;)

Was it helpful?

Solution

For UI with libgdx i would always use Scene2dUI. To let you know: scene2D uses SpriteBatch. A scene2D Stage has its own Camera and SpriteBatch, you can manipulate. This gives you the possibility to move the Camera for this Stage arround. You can simply draw your game-stuff and when you need a menu, call the stage.draw() in your render() method. This calls draw() for every Actor on this Stage. For menus i would suggest to use TableLayout. One thing to remember: Call spritebatch.end() before calling stage.draw(). Also read this: Scene2D Hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top