Game Development Reference
In-Depth Information
Menus and Options
In this chapter, we will create a menu for Canyon Bunny. There will be two buttons
for the player to choose from. One of the buttons is Play , which will start a new
game. The other button will show an options menu that contains a few changeable
settings, such as sound and music volumes. All the settings will be stored to and
loaded from a Preferences file to make them permanent.
It is essential to have some sort of mechanism to manage multiple screens if we want
to allow the player to switch between them. LibGDX provides a Game class, which
already supports such basic screen management.
You will also learn how to use LibGDX's scene graph called Scene2D to create
and organize complex menu structures as well as how to handle events such as
pressed buttons.
In this chapter, we will cover the following topics:
• Create and organize complex menu structures using Scene2D UI
• Store and load the game preferences
Managing multiple screens
We will now make some minor changes to our current class diagram to reflect the
support for multiple screens that we want to add to our game.
You might want to take a peek at the previous class diagram of
Canyon Bunny for a quick refresher. See Chapter 3 , Configuring the
Game , for the diagram.
Search WWH ::




Custom Search