0

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 ;)

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
Fabian König
  • 323
  • 2
  • 4
  • 10

1 Answers1

0

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.

Robert P
  • 9,398
  • 10
  • 58
  • 100
  • I need only 3 buttons in the game menu. I don´t think, that I need a table layout or scene2dUI for this? I had make that today morning, i used 2 Stages for that, the first for the game screen and the second for the menu. – Fabian König Feb 25 '14 at 17:28
  • For the menu i would use scene2dui as it was made for this. – Robert P Feb 26 '14 at 06:57
  • Just for curiosity: Are you using 2 stages now? So one for menu and one for game? – Robert P Feb 28 '14 at 16:09
  • Yes, but it don´t works great. I tried to use one SpriteBatch and one Stage separate and it works great! – Fabian König Feb 28 '14 at 21:25