Do you know if there is any tutorial or example out there showing how to handle multiple screens / scenes of a game?
For example, imagine I have a game with this structure:
- Cover
- Main menu
- Gameplay
- Credits
To put allthe code in just one java file might be a nightmare… I’d like to use different classes and probably different scenes, but I don’t know how to do it.
Thanks!
Extend
Sceneclass for all of these scenes. Make a class calledSceneManager, make a field of this class in yourBaseGameActivityimplementation. The scene manager has fields for all of the scenes, and you can make methods likeSceneManager.getCreditsScene(),SceneManager.getMenuScene()and so on.This way each scene has it’s own file-class, while another classtakes care of all of the scenes and the game activity itself just calls simple methods to access these scenes.