Tile
Index
Constructors
constructor
Parameters
options: TileOptions
Returns Tile
Properties
publicdata
Arbitrary data storage per tile, useful for any game specific data
publicevents
publicmap
Reference to the TileMap this tile is associated with
publicreadonlyx
Integer x coordinate of the tile
publicreadonlyy
Integer y coordinate of the tile
Accessors
publicbounds
Tile bounds in world space
Returns BoundingBox
publiccenter
Tile position in world space
Returns Vector
publicdefaultGeometry
Returns BoundingBox
publicheight
Height of the tile in pixels
Returns number
publicpos
Return the world position of the top left corner of the tile
Returns Vector
publicsolid
Wether this tile should be treated as solid by the tilemap
Returns boolean
Wether this tile should be treated as solid by the tilemap
Parameters
val: boolean
Returns void
publicwidth
Width of the tile in pixels
Returns number
Methods
publicaddCollider
Adds a custom collider to the Tile to use instead of it's bounds
If no collider is set but Tile.solid is set, the tile bounds are used as a collider.
Note! the Tile.solid must be set to true for it to act as a "fixed" collider
Parameters
collider: Collider
Returns void
publicaddGraphic
publicclearColliders
Clears all colliders from the Tile
Returns void
publicclearGraphics
Clear all graphics from this tile
Returns void
publicemit
Type parameters
- TEventName: EventKey<TilePointerEvents>
Parameters
eventName: TEventName
event: TilePointerEvents[TEventName]
Returns void
publicflagDirty
Returns boolean
publicgetColliders
Returns the list of colliders
Returns readonly Collider[]
publicgetGraphics
Current list of graphics for this tile
Returns readonly Graphic[]
publicgetGraphicsOffsets
Current list of offsets for this tile's graphics
Returns readonly Vector[]
publicoff
Type parameters
- TEventName: EventKey<TilePointerEvents>
Parameters
eventName: TEventName
handler: Handler<TilePointerEvents[TEventName]>
Returns void
publicon
Type parameters
- TEventName: EventKey<TilePointerEvents>
Parameters
eventName: TEventName
handler: Handler<TilePointerEvents[TEventName]>
Returns Subscription
publiconce
Type parameters
- TEventName: EventKey<TilePointerEvents>
Parameters
eventName: TEventName
handler: Handler<TilePointerEvents[TEventName]>
Returns Subscription
TileMap Tile
A light-weight object that occupies a space in a collision map. Generally created by a TileMap.
Tiles can draw multiple sprites. Note that the order of drawing is the order of the sprites in the array so the last one will be drawn on top. You can use transparency to create layers this way.