How to manage multiple scenes / screens on AndEngine for Android

Do you know if there is any tutorial or example showing how to handle multiple screens / scenes of a game?

For example, imagine that I have a game with this structure:

  • Cover
  • Main menu
  • Gameplay
  • Loans

Putting all the code in one java file can be a nightmare ... I would like to use different classes and possibly different scenes, but I do not know how to do this.

Thanks!

+4
source share
2 answers

Extend the Scene class for all of these scenes. Create a class called SceneManager , create a field for this class in your BaseGameActivity implementation. The scene manager has fields for all scenes, and you can create methods like SceneManager.getCreditsScene() , SceneManager.getMenuScene() , etc.

Thus, each scene has its own file class, while the other class care for all the scenes and the game activity itself simply calls simple methods to access these scenes.

+7
source

This tutorial you are looking for is a plataform game, it has a scene manager class that includes descriptors, spalsh, menus, loading and game scenes. It also privatizes the resource manager, which is used to load and unload resources from the scene in which you are located.

0
source

Source: https://habr.com/ru/post/1389103/


All Articles