Class Tile

a basic tile object

Hierarchy (view full)

Constructors

  • Parameters

    • x: number

      x index of the Tile in the map

    • y: number

      y index of the Tile in the map

    • gid: number

      tile gid

    • tileset: TMXTileset

      the corresponding tileset object

    Returns Tile

Properties

_center: Vector2d
col: number
flipped: boolean

Global flag that indicates if the tile is flipped

flippedAD: boolean

True if the tile is flipped anti-diagonally

flippedX: boolean

True if the tile is flipped horizontally

flippedY: boolean

True if the tile is flipped vertically

max: undefined | {
    x: number;
    y: number;
}
min: undefined | {
    x: number;
    y: number;
}
row: number
tileId: number

tileId

tileset: TMXTileset

tileset

type: string

the object type (used internally)

"Bounds"

Accessors

  • get bottom(): number
  • bottom coordinate of the bound

    Returns number

  • get centerX(): number
  • center position of the bound on the x axis

    Returns number

  • get centerY(): number
  • center position of the bound on the y axis

    Returns number

  • get right(): number
  • right coordinate of the bound

    Returns number

Methods

  • add the given vertices to the bounds definition.

    Parameters

    • vertices: Vector2d[] | Point[]

      an array of Vector2d or Point

    • Optionalclear: boolean = false

      either to reset the bounds before adding the new vertices

    Returns void

  • add the given bounds to the bounds definition.

    Parameters

    • bounds: Bounds
    • Optionalclear: boolean = false

      either to reset the bounds before adding the new vertices

    Returns void

  • add the given quad coordinates to this bound definition, multiplied by the given matrix

    Parameters

    • x0: number

      left X coordinates of the quad

    • y0: number

      top Y coordinates of the quad

    • x1: number

      right X coordinates of the quad

    • y1: number

      bottom y coordinates of the quad

    • Optionalm: any

      an optional transform to apply to the given frame coordinates

    Returns void

  • add the given point to the bounds definition.

    Parameters

    • point: Vector2d | Point

      the vector or point to be added to the bounds

    • Optionalm: any

      an optional transform to apply to the given point (if the given point is a Vector2d)

    Returns void

  • center the bounds position around the given coordinates

    Parameters

    • x: number

      the x coordinate around which to center this bounds

    • y: number

      the y coordinate around which to center this bounds

    Returns Tile

  • Returns true if the bounds contains the given point.

    Parameters

    • Rest...args: any

    Returns boolean

    True if the bounds contain the point, otherwise false

    if (bounds.contains(10, 10)) {
    // do something
    }
    // or
    if (bounds.contains(myVector2d)) {
    // do something
    }
  • return a renderable object for this Tile object

    Parameters

    • Optionalsettings: object

      see Sprite

    Returns Renderable

    a me.Sprite object

  • determines whether all coordinates of this bounds are finite numbers.

    Returns boolean

    false if all coordinates are positive or negative Infinity or NaN; otherwise, true.

  • sets the bounds to the given min and max value

    Parameters

    • minX: number
    • minY: number
    • maxX: number
    • maxY: number

    Returns void

  • Shifts the bounds to the given x, y position.

    Parameters

    • Rest...args: any

    Returns void

    bounds.shift(10, 10);
    // or
    bounds.shift(myVector2d);
  • Translates the bounds by the given point

    Parameters

    • Rest...args: any

    Returns void

    bounds.translate(10, 10);
    // or
    bounds.translate(myVector2d);