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 bottomnumber The sum of the y and height properties.
-
collideDown
-
- Default Value:
- false
- Source:
Properties:
Name Type Description collideDownboolean Indicating collide with any object on the bottom.
-
collideLeft
-
- Default Value:
- false
- Source:
Properties:
Name Type Description collideLeftboolean Indicating collide with any object on the left.
-
collideNone
-
- Default Value:
- true
- Source:
Properties:
Name Type Description collideNoneboolean Indicating this Tile doesn't collide at all.
-
collideRight
-
- Default Value:
- false
- Source:
Properties:
Name Type Description collideRightboolean Indicating collide with any object on the right.
-
collideUp
-
- Default Value:
- false
- Source:
Properties:
Name Type Description collideUpboolean Indicating collide with any object on the top.
-
collisionCallback
-
- Default Value:
- null
- Source:
Properties:
Name Type Description collisionCallbackboolean Tilemap collision callback.
-
collisionCallbackContext
-
- Source:
Properties:
Name Type Description collisionCallbackboolean Tilemap collision callback.
-
height
-
- Source:
Properties:
Name Type Description heightnumber The height of the tile in pixels.
-
index
-
- Source:
Properties:
Name Type Description indexnumber The index of this tile within the tileset.
-
mass
-
- Default Value:
- 1.0
- Source:
Properties:
Name Type Description massnumber The virtual mass of the tile.
-
<readonly> right
-
- Source:
Properties:
Name Type Description rightnumber The sum of the x and width properties.
-
separateX
-
- Default Value:
- true
- Source:
Properties:
Name Type Description separateXboolean Enable separation at x-axis.
-
separateY
-
- Default Value:
- true
- Source:
Properties:
Name Type Description separateYboolean Enable separation at y-axis.
-
tileset
-
- Source:
Properties:
Name Type Description tilesetPhaser.Tileset The tileset this tile belongs to.
-
width
-
- Source:
Properties:
Name Type Description widthnumber The width of the tile in pixels.
-
x
-
- Source:
Properties:
Name Type Description xnumber The top-left corner of the tile within the tileset.
-
y
-
- Source:
Properties:
Name Type Description ynumber 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 leftboolean Indicating collide with any object on the left.
rightboolean Indicating collide with any object on the right.
upboolean Indicating collide with any object on the top.
downboolean 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 callbackfunction Callback function.
contextobject Callback will be called with this context.
- Source: