Customizing managed scenes and layers
The main purpose of the scene manager is to handle the managed scenes in our game. The managed scenes are highly customizable, but we want to avoid rewriting as much of our code as possible. To achieve that task, we will use two classes that extend the ManagedScene
class, ManagedGameScene
and ManagedMenuScene
. By structuring our scene classes in this way, we will have menus and game scenes that share a common, respective foundation.
Getting ready...
Open the following classes from this chapter's code bundle: ManagedMenuScene.java
, ManagedGameScene.java
, MainMenu.java
, GameLevel.java
, and OptionsLayer.java
. We will be referencing these classes throughout this recipe.
How to do it...
Follow these steps to understand how the ManagedMenuScene
and ManagedGameScene
classes build upon the ManagedScene
class to create customized, extendable scenes that can be passed to the SceneManager
class:
Look at the
ManagedMenuScene
class. It holds only two simple constructors...