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:
- src/tilemap/Tile.js line 19
Members
-
alpha : number
-
The alpha value at which this tile is drawn to the canvas.
Type:
- number
- Source:
- src/tilemap/Tile.js line 84
-
<readonly> bottom : number
-
The sum of the y and height properties.
Type:
- number
- Source:
- src/tilemap/Tile.js line 398
-
<readonly> canCollide : boolean
-
True if this tile can collide on any of its faces or has a collision callback set.
Type:
- boolean
- Source:
- src/tilemap/Tile.js line 342
-
centerX
-
- Source:
- src/tilemap/Tile.js line 74
Properties:
Name Type Description width
number The width of the tile in pixels.
-
centerY
-
- Source:
- src/tilemap/Tile.js line 79
Properties:
Name Type Description height
number The height of the tile in pixels.
-
collideDown : boolean
-
Indicating collide with any object on the bottom.
Type:
- boolean
- Source:
- src/tilemap/Tile.js line 138
-
collideLeft : boolean
-
Indicating collide with any object on the left.
Type:
- boolean
- Source:
- src/tilemap/Tile.js line 120
-
collideRight : boolean
-
Indicating collide with any object on the right.
Type:
- boolean
- Source:
- src/tilemap/Tile.js line 126
-
<readonly> collides : boolean
-
True if this tile can collide on any of its faces.
Type:
- boolean
- Source:
- src/tilemap/Tile.js line 328
-
collideUp : boolean
-
Indicating collide with any object on the top.
Type:
- boolean
- Source:
- src/tilemap/Tile.js line 132
-
collisionCallback : function
-
Tile collision callback.
Type:
- function
- Source:
- src/tilemap/Tile.js line 144
-
collisionCallbackContext : object
-
The context in which the collision callback will be called.
Type:
- object
- Source:
- src/tilemap/Tile.js line 150
-
debug : boolean
-
Type:
- boolean
- Source:
- src/tilemap/Tile.js line 156
-
faceBottom : boolean
-
Is the bottom of this tile an interesting edge?
Type:
- boolean
- Source:
- src/tilemap/Tile.js line 104
-
faceLeft : boolean
-
Is the left of this tile an interesting edge?
Type:
- boolean
- Source:
- src/tilemap/Tile.js line 109
-
faceRight : boolean
-
Is the right of this tile an interesting edge?
Type:
- boolean
- Source:
- src/tilemap/Tile.js line 114
-
faceTop : boolean
-
Is the top of this tile an interesting edge?
Type:
- boolean
- Source:
- src/tilemap/Tile.js line 99
-
flipped : boolean
-
Whether this tile is flipped (mirrored) or not.
Type:
- boolean
- Source:
- src/tilemap/Tile.js line 49
-
height : number
-
The height of the tile in pixels.
Type:
- number
- Source:
- src/tilemap/Tile.js line 69
-
index : number
-
The index of this tile within the map data corresponding to the tileset, or -1 if this represents a blank/null tile.
Type:
- number
- Source:
- src/tilemap/Tile.js line 29
-
layer : object
-
The layer in the Tilemap data that this tile belongs to.
Type:
- object
- Source:
- src/tilemap/Tile.js line 24
-
<readonly> left : number
-
The x value in pixels.
Type:
- number
- Source:
- src/tilemap/Tile.js line 356
-
properties : object
-
Tile specific properties.
Type:
- object
- Source:
- src/tilemap/Tile.js line 89
-
<readonly> right : number
-
The sum of the x and width properties.
Type:
- number
- Source:
- src/tilemap/Tile.js line 370
-
rotation : number
-
The rotation angle of this tile.
Type:
- number
- Source:
- src/tilemap/Tile.js line 44
-
scanned : boolean
-
Has this tile been walked / turned into a poly?
Type:
- boolean
- Source:
- src/tilemap/Tile.js line 94
-
<readonly> top : number
-
The y value.
Type:
- number
- Source:
- src/tilemap/Tile.js line 384
-
width : number
-
The width of the tile in pixels.
Type:
- number
- Source:
- src/tilemap/Tile.js line 64
-
worldX
-
- Source:
- src/tilemap/Tile.js line 54
Properties:
Name Type Description x
number The x map coordinate of this tile.
-
worldY
-
- Source:
- src/tilemap/Tile.js line 59
Properties:
Name Type Description y
number The y map coordinate of this tile.
-
x : number
-
The x map coordinate of this tile.
Type:
- number
- Source:
- src/tilemap/Tile.js line 34
-
y : number
-
The y map coordinate of this tile.
Type:
- number
- Source:
- src/tilemap/Tile.js line 39
Methods
-
containsPoint(x, y)
-
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:
- src/tilemap/Tile.js line 161
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:
- src/tilemap/Tile.js line 303
-
destroy()
-
Clean up memory.
- Source:
- src/tilemap/Tile.js line 222
-
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:
- src/tilemap/Tile.js line 174
-
isInteresting(collides, faces)
-
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:
- src/tilemap/Tile.js line 274
Returns:
True if the Tile is interesting, otherwise false.
- Type
- boolean
-
resetCollision()
-
Reset collision status flags.
- Source:
- src/tilemap/Tile.js line 256
-
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.
- Source:
- src/tilemap/Tile.js line 234
-
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:
- src/tilemap/Tile.js line 208