API Docs for:
Show:

SceneManager Class

Module: gs

Manages the scenes of the game.

Methods

clear

()

Clears the stack of previous-scenes and disposes all previous-scenes. After that it is not possible to go back to a previous scene using gs.SceneManager.returnToPrevious().

returnToPrevious

(
  • callback
)

Returns to the previous scene if that scene was saved before.

Parameters:

  • callback Function
    • Called after the scene has been changed.

switchTo

(
  • scene
  • savePrevious
  • callback
)

Switches from the current scene to the specified one.

Parameters:

  • scene gs.Object_Base
    • The new scene.
  • savePrevious Boolean
    • Indicates if the current scene should be pushed to previous-scene stack instead of getting disposed. It is possible to switch back to that scene then using gs.SceneManager.returnToPrevious method.
  • callback Function
    • Called after the scene has been changed.

update

()

Updates the current scene and the scene-handling. Needs to be called once per frame.

Properties

callback

Function

Called if a scene-change has been done.

nextScene

gs.Object_Base

The next scene. If set, this scene will become the current scene after next update.

previousScenes

gs.Object_Base

An array of previous scenes. Used to jump back to last scene from a menu for example.

scene

gs.Object_Base

The current scene.

transitionData

Object

The transition-data like the graphic, vague, etc. used for a transition from one scene to another.