Gamestate
Info
Dependencies:
- EventHandler
- Saves
Implementation:
Gamestate.d on GitHub
Gamestate package allows to check for different game states (game start, game load or level change).
Initialization
Initialize with LeGo_Gamestate
flag.
Functions
Gamestate_AddListener
Gamestate_AddListener
Adds a listener/handler to the game-state event.
var func listener
This function will be called on a game-state change. The current game-state is passed as a parameter.
Gamestate_RemoveListener
Gamestate_RemoveListener
Removes game-state listener.
var func listener
Listener function to be removed.
Examples
There are now two possibilities. Everything can be done directly into the Init_Global
, or with EventHandler.
Init_Global
It can also be done like that:
EventHandler
This is the same as the
Init_Global
example, but it may look more elegant to some. Note
This is translation of article originally written by Gottfried and Lehona and hosted on LeGo's official documentation website.