Hold the stack of scenes (gdjs.RuntimeScene) being played.

Constructors

Methods

  • Parameters

    • Optional options: UpdateFromNetworkSyncDataOptions

    Returns boolean

  • Return the cause of the last scene stack change (and clear it): the cause declared with runWithSceneChangeCause, or 'external' (with the call stack of the change). Null if no change happened since the last call.

    Returns null | {
        cause: string;
        stack: null | string;
    }

  • Parameters

    • syncOptions: GetNetworkSyncDataOptions

    Returns null | SceneStackNetworkSyncData

  • Return true while the next scene, requested by a scene change, is still loading its assets. The stack can be empty during this time (after a replace): the game is not over, a scene is on its way.

    Returns boolean

  • Called by the RuntimeGame when the game resolution is changed. Useful to notify scene and layers that resolution is changed, as they might be caching it.

    Returns void

  • Pause the scene currently being played and start the new scene that is specified in options.sceneName. If options.externalLayoutName is set, also instantiate the objects from this external layout.

    Parameters

    • options: string | PushSceneOptions

      Contains the scene name and optional external layout name to instantiate.

    • Optional deprecatedExternalLayoutName: string

      Deprecated, use options.externalLayoutName instead.

    Returns null | RuntimeScene

  • Start the scene in options.sceneName, replacing the one currently being played. If options.clear is set to true, all running scenes are also removed from the stack of scenes.

    Parameters

    • options: string | ReplaceSceneOptions

      Contains the scene name and optional external layout name to instantiate.

    • Optional deprecatedClear: boolean

      Deprecated, use options.clear instead.

    Returns null | RuntimeScene

  • Attribute any scene stack change done by action to cause (e.g. 'game', 'networkSync', 'gameplayTest'...). The stack labels its own changes: a change requested by the game logic during step is attributed to 'game', an applied network sync to 'networkSync'. A change happening outside of any declared cause is recorded as 'external' (with the call stack that made it).

    Type Parameters

    • T

    Parameters

    • cause: string
    • action: (() => T)
        • (): T
        • Returns T

    Returns T

  • Parameters

    • sceneStackSyncData: SceneStackNetworkSyncData

    Returns void

  • Return true if a scene was loaded, false otherwise (i.e: game not yet started).

    Returns boolean