0
\$\begingroup\$

I want to make it so that when the player presses start, a side menu slides out and gives a player some option on one side of the screen, similar to Angry Birds or Pokemon. I'm not sure how to go about doing this but I think its somthing like putting an if statement in the render method?

render(){
     if(menuVisible){
     //draw menu?
     }
}

I'm fairly new to libgdx so I do not know how to use it to its fullest extent yet.

\$\endgroup\$
  • 1
    \$\begingroup\$ A good solution would be implementing a state mechanism. (This question is not specific to libgdx though.) \$\endgroup\$ – Appleshell Aug 7 '13 at 21:11
1
\$\begingroup\$

Your question is more about programming and not necessarily related to libGDX, you could implement it plenty of ways.

Using an if statement like this could definitively works but it might seems a bit ugly. Fortunately, libGDX provides a way to create code that fits UI creation and you should use it, it's called scene2d you can find the documentation here.

And you don't even need to create your actual menu from scratch since libGDX also provides out of the box actors to build user interfaces: https://code.google.com/p/libgdx/wiki/scene2dui

Your sliding menu could then be an Actor that you may translate in a direction or another on top of your game state to create the desired effect.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.