Class Tile

The Tile class represents a tile on a tilemap.

Constructors

Properties

animFrame: number = 0

The current frame of the animation.

animated: boolean = false

Whether the tile is animated.

frameStart: number = ...

The start time of the frame.

id: number
properties: Record<string, any>

The properties of the tile.

scene: Scene
size: Vector = ...

The size of the tile.

then: number = ...

The start time of the frame.

tileset: TMXTileset
type: string

The type of the tile.

Methods

  • Draws the tile at the specified position.

    Parameters

    • pos: Vector

      The position to draw the tile at.

    • flipH: boolean = false

      Whether to flip the tile horizontally (default: false).

    • flipV: boolean = false

      Whether to flip the tile vertically (default: false).

    • angle: number = 0

      The angle to rotate the tile by (default: 0).

    • scale: Vector = ...

      The scale to draw the tile at.

    Returns void

  • Gets the next GID (Global ID) for the tile. If the tile has an animation, it calculates the next frame based on the animation frames and durations. If the tile does not have an animation, it returns the tile's ID.

    Returns any

    The next GID for the tile.

  • Retrieves the properties of a tile based on its global ID (gid) and the tileset.

    Parameters

    • gid: number

      The global ID of the tile.

    • tileset: TMXTileset

      The tileset containing the tile.

    Returns {}

    The properties of the tile, or an empty object if no properties are found.