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
  • convertInverseCoords(sceneX: number, sceneY: number, result: FloatPoint): FloatPoint
  • createNewUniqueId(): number
  • createObjectsFrom(data: InstanceData[], xPos: number, yPos: number, zPos: 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

    • zPos: number

      The offset on Z 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
  • getAllLayerNames(result: string[]): void
  • getBackgroundColor(): number
  • getClearCanvas(): boolean
  • getElapsedTime(): number
  • getInitialSharedDataForBehavior(name: string): null | BehaviorSharedData
  • getInstancesCountOnScene(objectName: string): number
  • getName(): string
  • getRequestedScene(): string
  • getViewportHeight(): number
  • getViewportOriginX(): number
  • getViewportOriginY(): number
  • getViewportWidth(): number
  • hasLayer(name: string): boolean
  • isObjectRegistered(objectName: string): 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
  • registerObject(objectData: ObjectData): void
  • removeLayer(layerName: string): void
  • render(): 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

  • setClearCanvas(shouldClearCanvas: boolean): void
  • Set whether the canvas should be cleared before this scene rendering. This is experimental: if possible, try to avoid relying on this and use custom objects to build complex scenes.

    Parameters

    • shouldClearCanvas: boolean

    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
  • 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
  • unloadScene(): void
  • unregisterObject(objectName: string): void
  • updateObject(objectData: ObjectData): void
  • updateObjectsForces(): void

Constructors

Properties

pathfindingObstaclesManager: PathfindingObstaclesManager
physics2SharedData: null | Physics2SharedData
tileMapCollisionMaskManager: TileMapRuntimeManager

Generated using TypeDoc