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:
Members
-
alpha
-
- Source:
Properties:
Name Type Description alpha
number The alpha value at which this tile is drawn to the canvas.
-
<readonly> bottom
-
- Source:
Properties:
Name Type Description bottom
number The sum of the y and height properties.
-
callback
-
- Default Value:
- null
- Source:
Properties:
Name Type Description callback
function Tile collision callback.
-
callbackContext
-
- Source:
Properties:
Name Type Description callbackContext
object The context in which the collision callback will be called.
-
<readonly> canCollide
-
- Source:
Properties:
Name Type Description canCollide
boolean True if this tile can collide or has a collision callback.
-
collideDown
-
- Default Value:
- false
- Source:
Properties:
Name Type Description collideDown
boolean Indicating collide with any object on the bottom.
-
collideLeft
-
- Default Value:
- false
- Source:
Properties:
Name Type Description collideLeft
boolean Indicating collide with any object on the left.
-
collideNone
-
- Default Value:
- true
- Source:
Properties:
Name Type Description collideNone
boolean Indicating this Tile doesn't collide at all.
-
collideRight
-
- Default Value:
- false
- Source:
Properties:
Name Type Description collideRight
boolean Indicating collide with any object on the right.
-
collides
-
- Source:
Properties:
Name Type Description collides
boolean Does this tile collide at all?
-
collideUp
-
- Default Value:
- false
- Source:
Properties:
Name Type Description collideUp
boolean Indicating collide with any object on the top.
-
faceBottom
-
- Source:
Properties:
Name Type Description faceBottom
boolean Is the bottom of this tile an interesting edge?
-
faceLeft
-
- Source:
Properties:
Name Type Description faceLeft
boolean Is the left of this tile an interesting edge?
-
faceRight
-
- Source:
Properties:
Name Type Description faceRight
boolean Is the right of this tile an interesting edge?
-
faceTop
-
- Source:
Properties:
Name Type Description faceTop
boolean Is the top of this tile an interesting edge?
-
height
-
- Source:
Properties:
Name Type Description height
number The height of the tile in pixels.
-
index
-
- Source:
Properties:
Name Type Description index
number The index of this tile within the map data corresponding to the tileset.
-
layer
-
- Source:
Properties:
Name Type Description layer
object The layer in the Tilemap data that this tile belongs to.
-
<readonly> left
-
- Source:
Properties:
Name Type Description left
number The x value.
-
properties
-
- Source:
Properties:
Name Type Description properties
object Tile specific properties.
-
<readonly> right
-
- Source:
Properties:
Name Type Description right
number The sum of the x and width properties.
-
scanned
-
- Source:
Properties:
Name Type Description scanned
boolean Has this tile been walked / turned into a poly?
-
<readonly> top
-
- Source:
Properties:
Name Type Description top
number The y value.
-
width
-
- Source:
Properties:
Name Type Description width
number The width of the tile in pixels.
-
x
-
- Source:
Properties:
Name Type Description x
number The x map coordinate of this tile.
-
y
-
- Source:
Properties:
Name Type Description y
number The y map coordinate of this tile.
Methods
-
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:
-
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 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 with this context.
- Source: