melonJS
    Preparing search index...

    Class Tile

    a basic tile object

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _center: Vector2d
    col: number

    tile column position in the map

    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: XYPoint
    min: XYPoint
    row: number

    tile row position in the map

    tileId: number

    the global tile ID (with flip bits cleared)

    tileset: TMXTileset

    the corresponding tileset

    type: string

    Accessors

    Methods

    • Adds the given vertices to the bounds definition.

      Parameters

      • vertices: Vector2d[] | Point[] | XYPoint[]

        An array of Vector2d or Point to add to the bounds.

      • Optionalclear: boolean = false

        Whether to reset the bounds before adding the new vertices. Defaults to false.

      Returns void

    • Expands this bounds to include the axis-aligned bounding box of the given rect's four corners, optionally transformed through m first. With a non-identity m (rotation, scale, etc.) the result is the AABB of the transformed quad, not a transformed AABB.

      Parameters

      • x0: number

        The left x coordinate of the quad.

      • y0: number

        The top y coordinate of the quad.

      • x1: number

        The right x coordinate of the quad.

      • y1: number

        The bottom y coordinate of the quad.

      • Optionalm: Matrix3d | Matrix2d

        An optional transform applied to each corner before inclusion.

      Returns void

    • Expand this bounds to include every shape in shapes. Each shape contributes its own .getBounds() (so Rect, Polygon, Ellipse, Bounds, and anything else implementing the same getter all work); shapes without .getBounds() are silently ignored. Use clear=true to compute a fresh union (matches the add / addBounds shape).

      Useful for sizing a renderable from its bodyDef.shapes before the underlying physics body has been constructed — used by the TMX shape factory and Trigger.

      Parameters

      • shapes: { getBounds?: () => Bounds } | Iterable<{ getBounds?: () => Bounds }, any, any>

        one shape or an iterable of shapes

      • Optionalclear: boolean = false

        reset the bounds before unioning

      Returns void

    • Centers the bounds position around the given coordinates.

      Parameters

      • x: number

        The x coordinate to center around.

      • y: number

        The y coordinate to center around.

      Returns Tile

      The current Bounds instance for method chaining.

    • Sets the bounds to the given minimum and maximum values.

      Parameters

      • minX: number

        The minimum x value.

      • minY: number

        The minimum y value.

      • maxX: number

        The maximum x value.

      • maxY: number

        The maximum y value.

      Returns void