dino-ge
    Preparing search index...

    Class Tilemap

    Represents a grid-based map rendered from a tileset.

    Hierarchy (View Summary)

    Index
    actions: ActionQueue = ...

    Actions advanced for this object as active game time elapses.

    data: number[][]

    2D array of tile indices.

    id: string = ...

    Unique identifier for the game object.

    tileset: HTMLImageElement

    The source image for the tileset.

    tilesetCols: number

    Number of columns in the tileset image.

    tileSize: number

    Tile size in pixels.

    _registry: typeof Registry = Registry

    Static helper for tests to bypass Registry circularity if mocked.

    • Emits a custom event on this object's event bus.

      Parameters

      • type: string

        The event type.

      • Optionaldetail: unknown

        Optional data to pass with the event.

      Returns void

    • Stops listening for an event on this object's event bus.

      Parameters

      • type: string

        The event type.

      • callback: (event: CustomEvent) => void

        The function to remove.

      Returns void

    • Listens for an event on this object's event bus.

      Parameters

      • type: string

        The event type.

      • callback: (event: CustomEvent) => void

        The function to run when the event occurs.

      Returns void

    • Imports a finite orthogonal Tiled JSON map with square, numeric tile layers and point or rectangle object layers. Each tile layer produces one Tilemap per atlas used by its cells. Load atlas images and any external JSON tileset descriptors before calling this method. Objects and tile properties are returned as metadata for the game to interpret.

      Parameters

      Returns TiledMap