Class CameraObject

A GameObject with a 2D position.

Hierarchy

Constructors

Properties

#children: GameObject[] = []
#drawHandlers: Set<((delta: number) => void)> = ...
#inSceneTree: boolean = false
#preloadHandlers: Set<(() => void | Promise<void>)> = ...
#readyHandlers: Set<(() => void)> = ...
#updateHandlers: Set<((delta: number) => void)> = ...
camera: Camera
id: number

The numerical ID of a GameObject.

name: string

The name of a GameObject.

parent: null | GameObject = null

The parent of a GameObject in the scene tree. If the object has no parent or is not in the scene tree, this value is null

pos: Vector2

The 2D world position of the Object2D, relative to its parent.

cache: Map<number, GameObject> = ...

A map of GameObjects and their ids.

nextFreeID: number = 0

The next id available for a GameObject

Accessors

  • set inSceneTree(value: true): void
  • Set to true when the GameObject is added.

    Parameters

    • value: true

    Returns void

Methods

  • Built-in functionality of the GameObject called on draw.

    When extending GameObject, super.objectDraw(delta) must be called when overriding this.

    Parameters

    • delta: number

    Returns void

  • Built-in functionality of the GameObject called on preload.

    When extending GameObject, super.objectPreload() must be called when overriding this.

    Returns Promise<void>

  • Built-in functionality of the GameObject called on ready.

    When extending GameObject, super.objectReady() must be called when overriding this.

    Returns void

  • Built-in functionality of the GameObject called on update.

    When extending GameObject, super.objectUpdate(delta) must be called when overriding this.

    Parameters

    • delta: number

    Returns void

  • Adds a function to be called on preload. If the object is added to the scene after the game loads, it will be called right before the object is added.

    Parameters

    • f: (() => void | Promise<void>)
        • (): void | Promise<void>
        • Returns void | Promise<void>

    Returns CameraObject

  • Adds a function to be called on ready. If the object is added to the scene after the game loads, it will be called right after the object is added.

    Parameters

    • f: (() => void)
        • (): void
        • Returns void

    Returns CameraObject

Generated using TypeDoc