Options
All
  • Public
  • Public/Protected
  • All
Menu

A scene being played, containing instances of objects rendered on screen.

Hierarchy

Index

Methods

  • addLayer(layerData: LayerData): void
  • convertCoords(x: number, y: number, result: FloatPoint): FloatPoint
  • Convert a point from the canvas coordinates (for example, the mouse position) to the container coordinates.

    Parameters

    • x: number
    • y: number
    • result: FloatPoint

    Returns FloatPoint

  • convertInverseCoords(sceneX: number, sceneY: number, result: FloatPoint): FloatPoint
  • Convert a point from the container coordinates (for example, an object position) to the canvas coordinates.

    Parameters

    • sceneX: number
    • sceneY: number
    • result: FloatPoint

    Returns FloatPoint

  • createNewUniqueId(): number
  • Create an identifier for a new object of the scene.

    Returns number

  • createObjectsFrom(data: InstanceData[], xPos: number, yPos: number, trackByPersistentUuid: boolean): void
  • Create objects from initial instances data (for example, the initial instances of the scene or the instances of an external layout).

    Parameters

    • data: InstanceData[]

      The instances data

    • xPos: number

      The offset on X axis

    • yPos: number

      The offset on Y axis

    • trackByPersistentUuid: boolean

      If true, objects are tracked by setting their persistentUuid to the same as the associated instance. Useful for hot-reloading when instances are changed.

    Returns void

  • enableDebugDraw(enableDebugDraw: boolean, showHiddenInstances: boolean, showPointsNames: boolean, showCustomPoints: boolean): void
  • Activate or deactivate the debug visualization for collisions and points.

    Parameters

    • enableDebugDraw: boolean
    • showHiddenInstances: boolean
    • showPointsNames: boolean
    • showCustomPoints: boolean

    Returns void

  • getAllLayerNames(result: string[]): void
  • getBackgroundColor(): number
  • Get the background color, as an hexadecimal number.

    Returns number

    The current background color.

  • getElapsedTime(): number
  • getInitialSharedDataForBehavior(name: string): null | BehaviorSharedData
  • getInstancesCountOnScene(objectName: string): number
  • Return the number of instances of the specified object living in the container.

    Parameters

    • objectName: string

      The object name for which instances must be counted.

    Returns number

  • getName(): string
  • Get the name of the scene.

    Returns string

  • Get all the instances of the object called name.

    Parameters

    • name: string

      Name of the object for which the instances must be returned.

    Returns undefined | RuntimeObject[]

    The list of objects with the given name

  • Get the structure containing the triggers for "Trigger once" conditions.

    Returns OnceTriggers

  • Get the profiler associated with the scene, or null if none.

    Returns null | Profiler

  • getRequestedScene(): string
  • Return the name of the new scene to be launched.

    See requestChange.

    Returns string

  • Shortcut to get the SoundManager of the game.

    Returns HowlerSoundManager

    The gdjs.SoundManager of the game.

  • Get the TimeManager of the scene.

    Returns TimeManager

    The gdjs.TimeManager of the scene.

  • Get the variables of the runtimeScene.

    Returns VariablesContainer

    The container holding the variables of the scene.

  • getViewportHeight(): number
  • getViewportOriginX(): number
  • getViewportOriginY(): number
  • getViewportWidth(): number
  • hasLayer(name: string): boolean
  • isObjectRegistered(objectName: string): boolean
  • Check if an object is registered, meaning that instances of it can be created and lives in the container.

    see

    gdjs.RuntimeInstanceContainer#registerObject

    Parameters

    • objectName: string

    Returns boolean

  • loadFromScene(sceneData: null | LayoutData): void
  • Load the runtime scene from the given scene.

    see

    gdjs.RuntimeGame#getSceneData

    Parameters

    • sceneData: null | LayoutData

      An object containing the scene data.

    Returns void

  • onChildrenLocationChanged(): void
  • onGameResolutionResized(): void
  • Should be called when the canvas where the scene is rendered has been resized. See gdjs.RuntimeGame.startGameLoop in particular.

    Returns void

  • onPause(): void
  • Called when a scene is "paused", i.e it will be not be rendered again for some time, until it's resumed or unloaded.

    Returns void

  • onResume(): void
  • Called when a scene is "resumed", i.e it will be rendered again on screen after having being paused.

    Returns void

  • registerObject(objectData: ObjectData): void
  • removeLayer(layerName: string): void
  • render(): void
  • Render the PIXI container associated to the runtimeScene.

    Returns void

  • renderAndStep(elapsedTime: number): boolean
  • Step and render the scene.

    Parameters

    • elapsedTime: number

      In milliseconds

    Returns boolean

    true if the game loop should continue, false if a scene change/push/pop or a game stop was requested.

  • Request a scene change to be made. The change is handled externally (see gdjs.SceneStack) thanks to getRequestedChange and getRequestedScene methods.

    Parameters

    • change: SceneChangeRequest

      One of RuntimeScene.CONTINUE|PUSH_SCENE|POP_SCENE|REPLACE_SCENE|CLEAR_SCENES|STOP_GAME.

    • Optional sceneName: string

      The name of the new scene to launch, if applicable.

    Returns void

  • sceneJustResumed(): boolean
  • Check if the scene was just resumed. This is true during the first frame after the scene has been unpaused.

    Returns boolean

    true if the scene was just resumed

  • setBackgroundColor(r: number, g: number, b: number): void
  • Change the background color, by setting the RGB components. Internally, the color is stored as an hexadecimal number.

    Parameters

    • r: number

      The color red component (0-255).

    • g: number

      The color green component (0-255).

    • b: number

      The color blue component (0-255).

    Returns void

  • setEventsFunction(func: () => void): void
  • Set the function called each time the scene is stepped. The function will be passed the runtimeScene as argument.

    Note that this is already set up by the gdjs.RuntimeScene constructor and that you should not need to use this method.

    Parameters

    • func: () => void

      The function to be called.

        • (): void
        • Returns void

    Returns void

  • setEventsGeneratedCodeFunction(sceneData: LayoutData): void
  • Set the function called each time the scene is stepped to be the events generated code, which is by convention assumed to be a function in gdjs with a name based on the scene mangled name.

    Parameters

    • sceneData: LayoutData

      The scene data, used to find where the code was generated.

    Returns void

  • setInitialSharedDataForBehavior(name: string, sharedData: null | BehaviorSharedData): void
  • Set the data representing the initial shared data of the scene for the specified behavior.

    Parameters

    • name: string

      The name of the behavior

    • sharedData: null | BehaviorSharedData

      The shared data for the behavior, or null to remove it.

    Returns void

  • setLayerIndex(layerName: string, newIndex: number): void
  • startProfiler(onProfilerStopped: (oldProfiler: Profiler) => void): void
  • Start a new profiler to measures the time passed in sections of the engine in the scene.

    Parameters

    • onProfilerStopped: (oldProfiler: Profiler) => void

      Function to be called when the profiler is stopped. Will be passed the profiler as argument.

    Returns void

  • stopProfiler(): void
  • Stop the profiler being run on the scene.

    Returns void

  • unloadScene(): void
  • Called before a scene is removed from the stack of scenes rendered on the screen.

    Returns void

  • unregisterObject(objectName: string): void
  • updateObject(objectData: ObjectData): void
  • updateObjectsForces(): void

Constructors

Properties

pathfindingObstaclesManager: PathfindingObstaclesManager
physics2SharedData: null | Physics2SharedData
shiftyJsScene: Scene
tileMapCollisionMaskManager: TileMapRuntimeManager

Generated using TypeDoc