Class: Tile

Phaser. Tile

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

new Tile(tileset, index, x, y, width, height)

Create a new Tile object. Tiles live inside of Tilesets and are rendered via TilemapLayers.

Parameters:
Name Type Description
tileset Phaser.Tileset

The tileset 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:

Members

<readonly> bottom

Properties:
Name Type Description
bottom number

The sum of the y and height properties.

Source:

collideDown

Properties:
Name Type Description
collideDown boolean

Indicating collide with any object on the bottom.

Default Value:
  • false
Source:

collideLeft

Properties:
Name Type Description
collideLeft boolean

Indicating collide with any object on the left.

Default Value:
  • false
Source:

collideNone

Properties:
Name Type Description
collideNone boolean

Indicating this Tile doesn't collide at all.

Default Value:
  • true
Source:

collideRight

Properties:
Name Type Description
collideRight boolean

Indicating collide with any object on the right.

Default Value:
  • false
Source:

collideUp

Properties:
Name Type Description
collideUp boolean

Indicating collide with any object on the top.

Default Value:
  • false
Source:

collisionCallback

Properties:
Name Type Description
collisionCallback boolean

Tilemap collision callback.

Default Value:
  • null
Source:

collisionCallbackContext

Properties:
Name Type Description
collisionCallback boolean

Tilemap collision callback.

Source:

height

Properties:
Name Type Description
height number

The height of the tile in pixels.

Source:

index

Properties:
Name Type Description
index number

The index of this tile within the tileset.

Source:

mass

Properties:
Name Type Description
mass number

The virtual mass of the tile.

Default Value:
  • 1.0
Source:
Properties:
Name Type Description
right number

The sum of the x and width properties.

Source:

separateX

Properties:
Name Type Description
separateX boolean

Enable separation at x-axis.

Default Value:
  • true
Source:

separateY

Properties:
Name Type Description
separateY boolean

Enable separation at y-axis.

Default Value:
  • true
Source:

tileset

Properties:
Name Type Description
tileset Phaser.Tileset

The tileset this tile belongs to.

Source:

width

Properties:
Name Type Description
width number

The width of the tile in pixels.

Source:

x

Properties:
Name Type Description
x number

The top-left corner of the tile within the tileset.

Source:

y

Properties:
Name Type Description
y number

The top-left corner of the tile within the tileset.

Source:

Methods

destroy()

Clean up memory.

Source:

resetCollision()

Reset collision status flags.

Source:

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:

setCollisionCallback(callback, context)

Set callback to be called when this tilemap collides.

Parameters:
Name Type Description
callback function

Callback function.

context object

Callback will be called with this context.

Source:
Phaser Copyright © 2012-2013 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Thu Nov 28 2013 15:56:34 GMT-0000 (GMT) using the DocStrap template.