# Class: Tile

## Phaser. Tile

A Tile is a representation of a single tile within the Tilemap.

#### new Tile(layer, index, x, y, width, height)

  Create a new `Tile` object.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `layer` | object | The layer in the Tilemap data that this tile belongs to.
  `index` | number | The index of this tile type in the core map data.
  `x` | number | The x coordinate of this tile.
  `y` | number | The y coordinate of this tile.
  `width` | number | Width of the tile.
  `height` | number | Height of the tile.

  Source:
    - tilemap/Tile.js, line 20

### Members

#### alpha

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `alpha` | number | The alpha value at which this tile is drawn to the canvas.

  Source:
    - tilemap/Tile.js, line 75

#### <readonly> bottom

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `bottom` | number | The sum of the y and height properties.

  Source:
    - tilemap/Tile.js, line 382

#### <readonly> canCollide

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `canCollide` | boolean | True if this tile can collide on any of its faces or has a collision callback set.

  Source:
    - tilemap/Tile.js, line 330

#### centerX

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `width` | number | The width of the tile in pixels.

  Source:
    - tilemap/Tile.js, line 65

#### centerY

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `height` | number | The height of the tile in pixels.

  Source:
    - tilemap/Tile.js, line 70

#### collideDown

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `collideDown` | boolean | Indicating collide with any object on the bottom.

  Default Value:
    - false
  Source:
    - tilemap/Tile.js, line 129

#### collideLeft

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `collideLeft` | boolean | Indicating collide with any object on the left.

  Default Value:
    - false
  Source:
    - tilemap/Tile.js, line 111

#### collideRight

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `collideRight` | boolean | Indicating collide with any object on the right.

  Default Value:
    - false
  Source:
    - tilemap/Tile.js, line 117

#### <readonly> collides

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `collides` | boolean | True if this tile can collide on any of its faces.

  Source:
    - tilemap/Tile.js, line 317

#### collideUp

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `collideUp` | boolean | Indicating collide with any object on the top.

  Default Value:
    - false
  Source:
    - tilemap/Tile.js, line 123

#### collisionCallback

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `collisionCallback` | function | Tile collision callback.

  Default Value:
    - null
  Source:
    - tilemap/Tile.js, line 135

#### collisionCallbackContext

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `collisionCallbackContext` | object | The context in which the collision callback will be called.

  Source:
    - tilemap/Tile.js, line 141

#### faceBottom

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `faceBottom` | boolean | Is the bottom of this tile an interesting edge?

  Source:
    - tilemap/Tile.js, line 95

#### faceLeft

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `faceLeft` | boolean | Is the left of this tile an interesting edge?

  Source:
    - tilemap/Tile.js, line 100

#### faceRight

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `faceRight` | boolean | Is the right of this tile an interesting edge?

  Source:
    - tilemap/Tile.js, line 105

#### faceTop

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `faceTop` | boolean | Is the top of this tile an interesting edge?

  Source:
    - tilemap/Tile.js, line 90

#### height

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `height` | number | The height of the tile in pixels.

  Source:
    - tilemap/Tile.js, line 60

#### index

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `index` | number | The index of this tile within the map data corresponding to the tileset, or -1 if this represents a blank/null tile.

  Source:
    - tilemap/Tile.js, line 30

#### layer

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `layer` | object | The layer in the Tilemap data that this tile belongs to.

  Source:
    - tilemap/Tile.js, line 25

#### <readonly> left

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `left` | number | The x value in pixels.

  Source:
    - tilemap/Tile.js, line 343

#### properties

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `properties` | object | Tile specific properties.

  Source:
    - tilemap/Tile.js, line 80

#### <readonly> right

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `right` | number | The sum of the x and width properties.

  Source:
    - tilemap/Tile.js, line 356

#### scanned

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `scanned` | boolean | Has this tile been walked / turned into a poly?

  Source:
    - tilemap/Tile.js, line 85

#### <readonly> top

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `top` | number | The y value.

  Source:
    - tilemap/Tile.js, line 369

#### width

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `width` | number | The width of the tile in pixels.

  Source:
    - tilemap/Tile.js, line 55

#### worldX

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `x` | number | The x map coordinate of this tile.

  Source:
    - tilemap/Tile.js, line 45

#### worldY

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `y` | number | The y map coordinate of this tile.

  Source:
    - tilemap/Tile.js, line 50

#### x

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `x` | number | The x map coordinate of this tile.

  Source:
    - tilemap/Tile.js, line 35

#### y

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `y` | number | The y map coordinate of this tile.

  Source:
    - tilemap/Tile.js, line 40

### Methods

#### containsPoint(x, y) → {boolean}

  Check if the given x and y world coordinates are within this Tile.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `x` | number | The x coordinate to test.
  `y` | number | The y coordinate to test.

  Source:
    - tilemap/Tile.js, line 147

  ##### Returns:

  True if the coordinates are within this Tile, otherwise false.

  Type
    boolean

#### copy(tile)

  Copies the tile data and properties from the given tile to this tile.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `tile` | Phaser.Tile | The tile to copy from.

  Source:
    - tilemap/Tile.js, line 291

#### destroy()

  Clean up memory.

  Source:
    - tilemap/Tile.js, line 211

#### intersects(x, y, right, bottom)

  Check for intersection with this tile.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `x` | number | The x axis in pixels.
  `y` | number | The y axis in pixels.
  `right` | number | The right point.
  `bottom` | number | The bottom point.

  Source:
    - tilemap/Tile.js, line 161

#### isInteresting(collides, faces) → {boolean}

  Is this tile interesting?

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `collides` | boolean | If true will check any collides value.
  `faces` | boolean | If true will check any face value.

  Source:
    - tilemap/Tile.js, line 261

  ##### Returns:

  True if the Tile is interesting, otherwise false.

  Type
    boolean

#### resetCollision()

  Reset collision status flags.

  Source:
    - tilemap/Tile.js, line 242

#### setCollision(left, right, up, down)

  Set collision settings on this tile.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `left` | boolean | Indicating collide with any object on the left.
  `right` | boolean | Indicating collide with any object on the right.
  `up` | boolean | Indicating collide with any object on the top.
  `down` | boolean | Indicating collide with any object on the bottom.

  Source:
    - tilemap/Tile.js, line 224

#### setCollisionCallback(callback, context)

  Set a callback to be called when this tile is hit by an object. The callback must true true for collision processing to take place.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | function | Callback function.
  `context` | object | Callback will be called within this context.

  Source:
    - tilemap/Tile.js, line 196