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
-
- Source:
Properties:
Name Type Description bottom
number The sum of the y and height properties.
-
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.
-
collideUp
-
- Default Value:
- false
- Source:
Properties:
Name Type Description collideUp
boolean Indicating collide with any object on the top.
-
collisionCallback
-
- Default Value:
- null
- Source:
Properties:
Name Type Description collisionCallback
boolean Tilemap collision callback.
-
collisionCallbackContext
-
- Source:
Properties:
Name Type Description collisionCallback
boolean Tilemap collision callback.
-
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 tileset.
-
mass
-
- Default Value:
- 1.0
- Source:
Properties:
Name Type Description mass
number The virtual mass of the tile.
-
<readonly> right
-
- Source:
Properties:
Name Type Description right
number The sum of the x and width properties.
-
separateX
-
- Default Value:
- true
- Source:
Properties:
Name Type Description separateX
boolean Enable separation at x-axis.
-
separateY
-
- Default Value:
- true
- Source:
Properties:
Name Type Description separateY
boolean Enable separation at y-axis.
-
tileset
-
- Source:
Properties:
Name Type Description tileset
Phaser.Tileset The tileset this tile belongs to.
-
width
-
- Source:
Properties:
Name Type Description width
number The width of the tile in pixels.
-
x
-
- Source:
Properties:
Name Type Description x
number The top-left corner of the tile within the tileset.
-
y
-
- Source:
Properties:
Name Type Description y
number The top-left corner of the tile within the tileset.
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: