Options
All
  • Public
  • Public/Protected
  • All
Menu

The instance container of a custom object, containing instances of objects rendered on screen.

see

gdjs.CustomRuntimeObject

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

  • 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
  • getElapsedTime(): 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

  • 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
  • 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

  • Load the container from the given initial configuration.

    see

    gdjs.RuntimeGame#getSceneData

    Parameters

    • customObjectData: ObjectData & ObjectConfiguration & { childrenContent: {} }

      An object containing the container data.

    Returns void

  • onChildrenLocationChanged(): void
  • Called when the associated object is destroyed (because it is removed from its parent container or the scene is being unloaded).

    Parameters

    Returns void

  • registerObject(objectData: ObjectData): void
  • removeLayer(layerName: string): 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
  • unregisterObject(objectName: string): void
  • Called when the container must be updated using the specified objectData. This is the case during hot-reload, and is only called if the object was modified.

    Parameters

    • oldCustomObjectData: ObjectData & ObjectConfiguration & { childrenContent: {} }

      The previous data for the object.

    • newCustomObjectData: ObjectData & ObjectConfiguration & { childrenContent: {} }

      The new data for the object.

    Returns boolean

    true if the object was updated, false if it could not (i.e: hot-reload is not supported).

  • updateObject(objectData: ObjectData): void
  • updateObjectsForces(): void

Constructors

Properties

pathfindingObstaclesManager: PathfindingObstaclesManager
tileMapCollisionMaskManager: TileMapRuntimeManager

Generated using TypeDoc