Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Cell

TileMap Cell

A light-weight object that occupies a space in a collision map. Generally created by a TileMap.

Cells can draw multiple sprites. Note that the order of drawing is the order of the sprites in the array so the last one will be drawn on top. You can use transparency to create layers this way.

Hierarchy

  • Cell

Index

Constructors

constructor

  • new Cell(x: number, y: number, width: number, height: number, index: number, solid?: boolean, sprites?: TileSprite[]): Cell
  • Parameters

    • x: number

      Gets or sets x coordinate of the cell in world coordinates

    • y: number

      Gets or sets y coordinate of the cell in world coordinates

    • width: number

      Gets or sets the width of the cell

    • height: number

      Gets or sets the height of the cell

    • index: number

      The index of the cell in row major order

    • Default value solid: boolean = false

      Gets or sets whether this cell is solid

    • Default value sprites: TileSprite[] = []

      The list of tile sprites to use to draw in this cell (in order)

    Returns Cell

Properties

Private _bounds

_bounds: BoundingBox

height

height: number

Gets or sets the height of the cell

index

index: number

The index of the cell in row major order

solid

solid: boolean

Gets or sets whether this cell is solid

sprites

sprites: TileSprite[]

The list of tile sprites to use to draw in this cell (in order)

width

width: number

Gets or sets the width of the cell

x

x: number

Gets or sets x coordinate of the cell in world coordinates

y

y: number

Gets or sets y coordinate of the cell in world coordinates

Methods

clearSprites

  • clearSprites(): void
  • Clear all sprites from this cell

    Returns void

getBounds

  • Returns the bounding box for this cell

    Returns BoundingBox

getCenter

  • Gets the center coordinate of this cell

    Returns Vector

pushSprite

  • Add another TileSprite to this cell

    Parameters

    Returns void

removeSprite

  • Remove an instance of TileSprite from this cell

    Parameters

    Returns void