The GameStage
has a lifecycle methods:
-
GameStage.constructor() - This is the default class method, called once right after the stage has been registered in the app with System.registerStage().
Nothing special happens here. -
GameStage.register() - In this method, ISystem, which includes SystemSettings (systemSettings), ISystemAudio(audio), and INetwork(network), are attached to the GameStage. This is the place where assets should be added (see Assets Manager and How to add and use audio).
-
GameStage.init() - This method is called after ISystem.startGameStage() is invoked. It is called only once per game. Assets that were added in the register() stage will already be loaded and ready to be used here.
-
GameStage.start() - This method is called right after GameStage.init(). If the stage is stopped with ISystem.stopGameStage() and then restarted, it will be called again without invoking GameStage.init() on the second start.
-
GameStage.stop() - This method is called after ISystem.stopGameStage() is invoked. It can be used to shut down the stage, remove listeners, etc.
All methods above can be overwritten.
