Tile
Class: Phaser.Tile
Constructor
new Tile(layer, index, x, y, width, height)
A Tile is a representation of a single tile within the Tilemap.
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 code: tilemap/Tile.js (Line 19)
Public Properties
- Source code: tilemap/Tile.js (Line 84)
- Source code: tilemap/Tile.js (Line 396)
- Source code: tilemap/Tile.js (Line 344)
- Source code: tilemap/Tile.js (Line 74)
- Source code: tilemap/Tile.js (Line 79)
- Source code: tilemap/Tile.js (Line 138)
- Source code: tilemap/Tile.js (Line 120)
- Source code: tilemap/Tile.js (Line 126)
- Source code: tilemap/Tile.js (Line 331)
- Source code: tilemap/Tile.js (Line 132)
- Source code: tilemap/Tile.js (Line 144)
- Source code: tilemap/Tile.js (Line 150)
- Source code: tilemap/Tile.js (Line 104)
- Source code: tilemap/Tile.js (Line 109)
- Source code: tilemap/Tile.js (Line 114)
- Source code: tilemap/Tile.js (Line 99)
- Source code: tilemap/Tile.js (Line 49)
- Source code: tilemap/Tile.js (Line 69)
- Source code: tilemap/Tile.js (Line 29)
- Source code: tilemap/Tile.js (Line 24)
- Source code: tilemap/Tile.js (Line 357)
- Source code: tilemap/Tile.js (Line 89)
- Source code: tilemap/Tile.js (Line 370)
- Source code: tilemap/Tile.js (Line 44)
- Source code: tilemap/Tile.js (Line 94)
- Source code: tilemap/Tile.js (Line 383)
- Source code: tilemap/Tile.js (Line 64)
- Source code: tilemap/Tile.js (Line 54)
- Source code: tilemap/Tile.js (Line 59)
- Source code: tilemap/Tile.js (Line 34)
- Source code: tilemap/Tile.js (Line 39)
alpha : number
The alpha value at which this tile is drawn to the canvas.
[readonly] bottom : number
The sum of the y and height properties.
[readonly] canCollide : boolean
True if this tile can collide on any of its faces or has a collision callback set.
centerX
Properties:
Name | Type | Description |
---|---|---|
width | number | The width of the tile in pixels. |
centerY
Properties:
Name | Type | Description |
---|---|---|
height | number | The height of the tile in pixels. |
collideDown : boolean
Indicating collide with any object on the bottom.
collideLeft : boolean
Indicating collide with any object on the left.
collideRight : boolean
Indicating collide with any object on the right.
[readonly] collides : boolean
True if this tile can collide on any of its faces.
collideUp : boolean
Indicating collide with any object on the top.
collisionCallback : Function
Tile collision callback.
collisionCallbackContext : Object
The context in which the collision callback will be called.
faceBottom : boolean
Is the bottom of this tile an interesting edge?
faceLeft : boolean
Is the left of this tile an interesting edge?
faceRight : boolean
Is the right of this tile an interesting edge?
faceTop : boolean
Is the top of this tile an interesting edge?
flipped : boolean
Whether this tile is flipped (mirrored) or not.
height : number
The height of the tile in pixels.
index : number
The index of this tile within the map data corresponding to the tileset, or -1 if this represents a blank/null tile.
layer : Object
The layer in the Tilemap data that this tile belongs to.
[readonly] left : number
The x value in pixels.
properties : Object
Tile specific properties.
[readonly] right : number
The sum of the x and width properties.
rotation : number
The rotation angle of this tile.
scanned : boolean
Has this tile been walked / turned into a poly?
[readonly] top : number
The y value.
width : number
The width of the tile in pixels.
worldX
Properties:
Name | Type | Description |
---|---|---|
x | number | The x map coordinate of this tile. |
worldY
Properties:
Name | Type | Description |
---|---|---|
y | number | The y map coordinate of this tile. |
x : number
The x map coordinate of this tile.
y : number
The y map coordinate of this tile.
Public Methods
- Source code: tilemap/Tile.js (Line 156)
- Source code: tilemap/Tile.js (Line 305)
- Source code: tilemap/Tile.js (Line 220)
- Source code: tilemap/Tile.js (Line 170)
- Source code: tilemap/Tile.js (Line 275)
- Source code: tilemap/Tile.js (Line 256)
- Source code: tilemap/Tile.js (Line 233)
- Source code: tilemap/Tile.js (Line 205)
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. |
Returns
True if the coordinates are within this Tile, otherwise false.
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. |
destroy()
Clean up memory.
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. |
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. |
Returns
True if the Tile is interesting, otherwise false.
resetCollision()
Reset collision status flags.
setCollision(left, right, up, down)
Sets the collision flags for each side of this tile and updates the interesting faces list.
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. |
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. |
© 2016 Richard Davey, Photon Storm Ltd.
Licensed under the MIT License.
http://phaser.io/docs/2.6.2/Phaser.Tile.html