The LayerData object in the Tilemap that this tile belongs to.
The unique index of this tile within the map.
The x coordinate of this tile in tile coordinates.
The y coordinate of this tile in tile coordinates.
Width of the tile in pixels.
Height of the tile in pixels.
The base width a tile in the map (in pixels). Tiled maps support multiple tileset sizes within one map, but they are still placed at intervals of the base tile width.
The base height of the tile in pixels. Tiled maps support multiple tileset sizes within one map, but they are still placed at intervals of the base tile height.
The alpha value of the Game Object.
This is a global value, impacting the entire Game Object, not just a region of it. The value is clamped to the range [0, 1]. Setting alpha to 0 also clears the render flag, preventing the Game Object from being drawn until the alpha is raised above 0 again.
The map's base height of a tile in pixels. Tiled maps support multiple tileset sizes within one map, but they are still placed at intervals of the base tile size.
The map's base width of a tile in pixels. Tiled maps support multiple tileset sizes within one map, but they are still placed at intervals of the base tile size.
The bottom of the tile in pixels.
Set in the updatePixelXY method.
ReadonlycanTrue if this tile can collide on any of its faces or has a collision callback set.
Whether the tile should collide with any object on the bottom side.
This property is used by Arcade Physics only, however, you can also use it in your own checks.
Whether the tile should collide with any object on the left side.
This property is used by Arcade Physics only, however, you can also use it in your own checks.
Whether the tile should collide with any object on the right side.
This property is used by Arcade Physics only, however, you can also use it in your own checks.
ReadonlycollidesTrue if this tile can collide on any of its faces.
Whether the tile should collide with any object on the top side.
This property is used by Arcade Physics only, however, you can also use it in your own checks.
An optional callback function that is invoked when an Arcade Physics body collides with
this tile. The callback must return true for collision processing to take place. Set
via setCollisionCallback.
The context in which the collision callback will be called.
Whether the tile's bottom edge is interesting for collisions.
Whether the tile's left edge is interesting for collisions.
Whether the tile's right edge is interesting for collisions.
Whether the tile's top edge is interesting for collisions.
The horizontally flipped state of the Game Object.
A Game Object that is flipped horizontally will render inverted on the horizontal axis. Flipping always takes place from the middle of the texture and does not impact the scale value. If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.
The vertically flipped state of the Game Object.
A Game Object that is flipped vertically will render inverted on the vertical axis (i.e. upside down). Flipping always takes place from the middle of the texture and does not impact the scale value. If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.
ReadonlyhasTrue if this tile has any interesting faces.
The height of the tile in pixels.
The index of this tile within the map data corresponding to the tileset, or -1 if this represents a blank tile.
The LayerData in the Tilemap data that this tile belongs to.
An empty object where physics-engine specific information (e.g. bodies) may be stored.
The x coordinate of the top left of this tile in pixels. This is relative to the top left of the layer this tile is being rendered within. This property does NOT factor in camera scroll, layer scale or layer position.
The y coordinate of the top left of this tile in pixels. This is relative to the top left of the layer this tile is being rendered within. This property does NOT factor in camera scroll, layer scale or layer position.
Tile specific properties. These usually come from Tiled.
The right of the tile in pixels.
Set in the updatePixelXY method.
The rotation angle of this tile.
ReadonlytilemapThe tilemap that contains this Tile. This will only return null if accessed from a LayerData instance before the tile is placed within a TilemapLayer.
ReadonlytilemapThe tilemap layer that contains this Tile. This will only return null if accessed from a LayerData instance before the tile is placed within a TilemapLayer.
ReadonlytilesetThe tileset that contains this Tile. This is null if accessed from a LayerData instance before the tile is placed in a TilemapLayer, or if the tile has an index that doesn't correspond to any of the map's tilesets.
The tint to apply to this tile. Note: tint is currently a single color value instead of the 4 corner tint component on other GameObjects.
The secondary tint to apply to this tile. Used in two-color tint modes.
The tint mode.
Available modes are:
The visible state of the Game Object.
An invisible Game Object will skip rendering, but will still process update logic.
The width of the tile in pixels.
The x map coordinate of this tile in tile units.
The y map coordinate of this tile in tile units.
Clears the alpha value associated with this Game Object.
Immediately sets the alpha back to 1 (fully opaque).undefined
This Game Object instance.
Check if the given x and y world coordinates are within this Tile. This does not factor in camera scroll, layer scale or layer position.
The x coordinate to test.
The y coordinate to test.
True if the coordinates are within this Tile, otherwise false.
Copies the tile data and properties from the given Tile to this Tile. This copies everything except for position and interesting face calculations.
The tile to copy from.
This Tile object instance.
Destroys this tile by nullifying its collision callback and custom properties, releasing references that could otherwise prevent garbage collection.
Gets the world Y position of the bottom side of the tile, factoring in the layer's position, scale and scroll.
Optionalcamera: Camera
The Camera to use to perform the check.
The bottom (y) value of this tile.
Gets the world rectangle bounding box for the tile, factoring in the layer's position, scale and scroll.
The bounds of this Tile.
Gets the world X position of the center of the tile, factoring in the layer's position, scale and scroll.
Optionalcamera: Camera
The Camera to use to perform the check.
The center x position of this Tile.
Gets the world Y position of the center of the tile, factoring in the layer's position, scale and scroll.
Optionalcamera: Camera
The Camera to use to perform the check.
The center y position of this Tile.
The collision group for this Tile, defined within the Tileset. This returns a reference to the collision group stored within the Tileset, so any modification of the returned object will impact all tiles that have the same index as this tile.undefined
The collision group for this Tile, as defined in the Tileset, or null if no group was defined.
Gets the world X position of the left side of the tile, factoring in the layer's position, scale and scroll.
Optionalcamera: Camera
The Camera to use to perform the check.
The left (x) value of this tile.
Gets the world X position of the right side of the tile, factoring in the layer's position, scale and scroll.
Optionalcamera: Camera
The Camera to use to perform the check.
The right (x) value of this tile.
The tile data for this Tile, defined within the Tileset. This typically contains Tiled collision data, tile animations and terrain information. This returns a reference to the tile data stored within the Tileset, so any modification of the returned object will impact all tiles that have the same index as this tile.undefined
The tile data for this Tile, as defined in the Tileset, or null if no data was defined.
Gets the world Y position of the top side of the tile, factoring in the layer's position, scale and scroll.
Optionalcamera: Camera
The Camera to use to perform the check.
The top (y) value of this tile.
Check for intersection with this tile. This does not factor in camera scroll, layer scale or layer position.
The left edge of the rectangle to intersect with, in pixels.
The top edge of the rectangle to intersect with, in pixels.
The right edge of the rectangle to intersect with, in pixels.
The bottom edge of the rectangle to intersect with, in pixels.
true if the Tile intersects with the given dimensions, otherwise false.
Checks whether this tile is considered "interesting" based on the provided criteria. A tile is interesting if it has active collision flags on any side, if it has an interesting face, or both, depending on the arguments passed. This is used internally by the tilemap collision system to quickly filter tiles that need further processing.
If true, will consider the tile interesting if it collides on any side.
If true, will consider the tile interesting if it has an interesting face.
True if the Tile is interesting, otherwise false.
Resets all collision status flags on this tile to false, clearing any collisions set on
each of its four edges. If recalculateFaces is true (the default), the interesting face
flags for this tile and its neighbors in the layer are also recalculated.
OptionalrecalculateFaces: boolean
Whether or not to recalculate interesting faces for this tile and its neighbors. Default true.
This Tile object instance.
Resets all four interesting face flags (faceTop, faceBottom, faceLeft, faceRight)
to false. Unlike resetCollision, this does not affect the collision flags and does not
trigger a face recalculation on neighboring tiles.undefined
This Tile object instance.
Resets the horizontal and vertical flipped state of this Game Object back to their default un-flipped state.undefined
This Game Object instance.
Set the Alpha level of this Game Object. The alpha controls the opacity of the Game Object as it renders. Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque.
Optionalvalue: number
The alpha value applied across the whole Game Object. Default 1.
This Game Object instance.
Sets the collision flags for each side of this tile and updates the interesting faces list.
Indicating collide with any object on the left.
Optionalright: boolean
Indicating collide with any object on the right.
Optionalup: boolean
Indicating collide with any object on the top.
Optionaldown: boolean
Indicating collide with any object on the bottom.
OptionalrecalculateFaces: boolean
Whether or not to recalculate interesting faces for this tile and its neighbors. Default true.
This Tile object instance.
Set a callback to be called when this tile is hit by an object. The callback must return true for collision processing to take place.
Callback function.
Callback will be called within this context.
This Tile object instance.
Sets the horizontal and vertical flipped state of this Game Object.
A Game Object that is flipped will render inverted on the flipped axis. Flipping always takes place from the middle of the texture and does not impact the scale value. If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.
The horizontal flipped state. false for no flip, or true to be flipped.
The vertical flipped state. false for no flip, or true to be flipped.
This Game Object instance.
Sets the horizontal flipped state of this Game Object.
A Game Object that is flipped horizontally will render inverted on the horizontal axis. Flipping always takes place from the middle of the texture and does not impact the scale value. If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.
The flipped state. false for no flip, or true to be flipped.
This Game Object instance.
Sets the vertical flipped state of this Game Object.
A Game Object that is flipped vertically will render inverted on the vertical axis. Flipping always takes place from the middle of the texture and does not impact the scale value. If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.
The flipped state. false for no flip, or true to be flipped.
This Game Object instance.
Sets the size of the tile and updates its pixelX and pixelY.
The width of the tile in pixels.
The height of the tile in pixels.
The base width a tile in the map (in pixels).
The base height of the tile in pixels.
This Tile object instance.
Sets the visibility of this Game Object.
An invisible Game Object will skip rendering, but will still process update logic.
The visible state of the Game Object.
This Game Object instance.
Toggles the horizontal flipped state of this Game Object.
A Game Object that is flipped horizontally will render inverted on the horizontal axis. Flipping always takes place from the middle of the texture and does not impact the scale value. If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.undefined
This Game Object instance.
Toggles the vertical flipped state of this Game Object.
A Game Object that is flipped vertically will render inverted on the vertical axis. Flipping always takes place from the middle of the texture and does not impact the scale value. If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.undefined
This Game Object instance.
Used internally. Updates the tile's world XY position based on the current tile size.undefined
This Tile object instance.
A Tile is a representation of a single tile within a Tilemap layer. Each tile has a position within the map grid (in tile coordinates), a size in pixels, collision flags for each of its four edges, optional custom properties imported from the Tiled map editor, and an optional collision callback. Tiles are lightweight data objects - they do not extend GameObject - so their pixel positions are stored relative to the layer origin and do not factor in camera scroll, layer scale, or layer position. Use the
getLeft,getRight,getTop,getBottom, andgetBoundsmethods to obtain world-space coordinates that account for those transforms.Tiles are created and managed by
TilemapLayerand should not normally be instantiated directly. You can access them viaTilemapLayer.getTileAtor similar Tilemap methods.