rapid-render
    Preparing search index...

    Class Entity

    Base class for game entities with transform and rendering capabilities.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    children: Entity[] = []
    game: Game
    globalZindex: number = 0
    localZindex: number = 0
    parent: null | Entity = null
    position: Vec2
    rapid: Rapid
    rotation: number
    scale: Vec2
    tags: string[]
    transform: MatrixStack = ...

    Accessors

    • get x(): number

      Returns number

    • set x(nx: number): void

      Parameters

      • nx: number

      Returns void

    • get y(): number

      Returns number

    • set y(ny: number): void

      Parameters

      • ny: number

      Returns void

    Methods

    • Adds a child entity to this entity.

      Parameters

      • child: Entity

        The entity to add as a child.

      Returns void

    • Disposes of the entity and its children.

      Returns void

    • Finds descendant entities matching a predicate.

      Parameters

      • predicate: (entity: Entity) => boolean

        Function to test each entity.

      • onlyFirst: boolean = true

        If true, returns only the first match; otherwise, returns all matches.

      Returns null | Entity | Entity[]

      A single entity, an array of entities, or null if no matches are found.

    • Finds descendant entities with all specified tags.

      Parameters

      • tags: string[]

        Array of tags to match.

      • onlyFirst: boolean = false

        If true, returns only the first match; otherwise, returns all matches.

      Returns null | Entity | Entity[]

      A single entity, an array of entities, or null if no matches are found.

    • Gets the parent transform or the renderer's matrix stack if no parent exists.

      Returns MatrixStack

      The transform matrix stack.

    • Hook for custom rendering logic.

      Parameters

      • render: Rapid

        The rendering engine instance.

      Returns void

    • Hook for custom update logic.

      Parameters

      • deltaTime: number

        Time elapsed since the last update in seconds.

      Returns void

    • Hook for custom cleanup logic before disposal.

      Returns void

    • Removes a child entity from this entity.

      Parameters

      • child: Entity

        The entity to remove.

      Returns void

    • Updates the entity and its children.

      Parameters

      • deltaTime: number

        Time elapsed since the last update in seconds.

      Returns void

    • Updates the entity's transform, optionally updating parent transforms.

      Parameters

      • deep: boolean = false

        If true, recursively updates parent transforms.

      Returns void