Options
All
  • Public
  • Public/Protected
  • All
Menu

A container of object instances rendered on screen.

Hierarchy

Index

Methods

  • addLayer(layerData: LayerData): any
  • Add a layer.

    Parameters

    • layerData: LayerData

      The data to construct the layer

    Returns any

  • Add an object to the instances living in the container.

    Parameters

    Returns 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

      The x position, in container coordinates.

    • y: number

      The y position, in container coordinates.

    • Optional result: FloatPoint

      The point instance that is used to return the result.

    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

      The x position, in container coordinates.

    • sceneY: number

      The y position, in container coordinates.

    • result: FloatPoint

      The point instance that is used to return the result.

    Returns FloatPoint

  • Create a new object from its name. The object is also added to the instances living in the container (No need to call gdjs.RuntimeScene.addObject)

    Parameters

    • objectName: string

      The name of the object to be created

    Returns null | RuntimeObject

    The created object

  • 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

  • Get a list of all gdjs.RuntimeObject living in the container. You should not, normally, need this method at all. It's only to be used in exceptional use cases where you need to loop through all objects, and it won't be performant.

    Returns RuntimeObject[]

    The list of all runtime objects in the container

  • getAllLayerNames(result: string[]): void
  • Fill the array passed as argument with the names of all layers

    Parameters

    • result: string[]

      The array where to put the layer names

    Returns void

  • getElapsedTime(): number
  • Return the time elapsed since the last frame, in milliseconds, for objects on the layer.

    Returns number

  • getInitialSharedDataForBehavior(name: string): null | BehaviorSharedData
  • Get the data representing the initial shared data of the scene for the specified behavior.

    Parameters

    • name: string

      The name of the behavior

    Returns null | BehaviorSharedData

    The shared data for the behavior, if any.

  • 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

  • Parameters

    • objectName: string

      The name of the object

    Returns RuntimeObject[]

    the instances of a given object in the container.

  • Get the layer with the given name

    Parameters

    • name: string

      The name of the layer

    Returns RuntimeLayer

    The layer, or the base layer if not found

  • 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

  • getViewportHeight(): number
  • getViewportOriginX(): number
  • getViewportOriginY(): number
  • getViewportWidth(): number
  • hasLayer(name: string): boolean
  • Check if a layer exists

    Parameters

    • name: string

      The name of the layer

    Returns 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

  • Must be called whenever an object must be removed from the container.

    Parameters

    Returns void

  • onChildrenLocationChanged(): void
  • Triggered when the AABB of a child of the container could have changed.

    Returns void

  • registerObject(objectData: ObjectData): void
  • Register a gdjs.RuntimeObject so that instances of it can be used in the container.

    Parameters

    • objectData: ObjectData

      The data for the object to register.

    Returns void

  • removeLayer(layerName: string): void
  • Remove a layer. All gdjs.RuntimeObject on this layer will be moved back to the base layer.

    Parameters

    • layerName: string

      The name of the layer to remove

    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
  • Change the position of a layer.

    Parameters

    • layerName: string

      The name of the layer to reorder

    • newIndex: number

    Returns void

  • unregisterObject(objectName: string): void
  • Unregister a gdjs.RuntimeObject. Instances will be destroyed.

    Parameters

    • objectName: string

      The name of the object to unregister.

    Returns void

  • updateObject(objectData: ObjectData): void
  • Update the data of a gdjs.RuntimeObject so that instances use this when constructed.

    Parameters

    • objectData: ObjectData

      The data for the object to register.

    Returns void

  • updateObjectsForces(): void
  • Update the objects positions according to their forces

    Returns void

Constructors

Properties

pathfindingObstaclesManager: PathfindingObstaclesManager
tileMapCollisionMaskManager: TileMapRuntimeManager

Generated using TypeDoc