TileMap
Hierarchy
- Entity
- TileMap
Implements
- HasNestedPointerEvents
Index
Constructors
Properties
Accessors
Methods
- addChild
- addComponent
- addTag
- addTemplate
- clearComponents
- clone
- debug
- draw
- emit
- flagCollidersDirty
- flagTilesDirty
- get
- getAncestors
- getColumns
- getComponents
- getCompositeCollider
- getDescendants
- getOnScreenTiles
- getRows
- getTile
- getTileByIndex
- getTileByPoint
- has
- hasAll
- hasAllTags
- hasChild
- hasTag
- isKilled
- kill
- off
- on
- onAdd
- once
- onInitialize
- onPostUpdate
- onPreUpdate
- onRemove
- removeAllChildren
- removeChild
- removeComponent
- removeTag
- unparent
Constructors
constructor
Parameters
options: TileMapOptions
Returns TileMap
Properties
publicinherited_componentsToRemove
publicinheritedchildrenAdded$
publicinheritedchildrenRemoved$
publiccollider
publicreadonlycolumns
publicinheritedcomponentAdded$
publicinheritedcomponentRemoved$
publicreadonlyinheritedcomponents
Current components on the entity
Do not modify
Use addComponent/removeComponent otherwise the ECS will not be notified of changes.
publicinheritedcomponentValues
publicevents
Listen to or emit events for an entity
publicinheritedid
The unique identifier for the entity
publicinheritedisActive
Whether this entity is active, if set to false it will be reclaimed
publiclogger
publicmeshingLookBehind
publicinheritedname
publicpointer
publicrenderFromTopOfGraphic
publicreadonlyrows
publicinheritedscene
The current scene that the entity is in, if any
publicinheritedtagAdded$
publicinheritedtagRemoved$
publicreadonlytileHeight
publicreadonlytiles
publicreadonlytileWidth
publictransform
Accessors
publicinheritedactive
Whether this entity is active, if set to false it will be reclaimed
Returns boolean
Whether this entity is active, if set to false it will be reclaimed
Parameters
val: boolean
Returns void
publicinheritedchildren
Get the direct children of this entity
Returns readonly Entity<any>[]
publicheight
Height of the whole tilemap in pixels
Returns number
publicinheritedisAdded
Returns boolean
publicinheritedisInitialized
Gets whether the actor is Initialized
Returns boolean
publicinheritedparent
Returns Entity<any> | null
publicpos
publicrotation
Returns number
Parameters
val: number
Returns void
publicscale
publicinheritedtags
Specifically get the tags on the entity from TagsComponent
Returns Set<string>
publicinheritedtypes
The types of the components on the Entity
Returns ComponentCtor[]
publicvel
publicwidth
Width of the whole tile map in pixels
Returns number
publicx
Returns number
Parameters
val: number
Returns void
publicy
Returns number
Parameters
val: number
Returns void
publicz
Returns number
Parameters
val: number
Returns void
Methods
publicinheritedaddChild
publicinheritedaddComponent
publicinheritedaddTag
Adds a tag to an entity
Parameters
tag: string
Returns Entity<any>
publicinheritedaddTemplate
publicinheritedclearComponents
Returns void
publicinheritedclone
Creates a deep copy of the entity and a copy of all its components
Returns Entity
publicdebug
Parameters
gfx: ExcaliburGraphicsContext
debugFlags: DebugConfig
Returns void
publicdraw
Draws the tile map to the screen. Called by the Scene.
Parameters
ctx: ExcaliburGraphicsContext
ExcaliburGraphicsContext
elapsed: number
The number of milliseconds since the last draw
Returns void
publicemit
Type parameters
- TEventName: EventKey<TileMapEvents>
Parameters
eventName: TEventName
event: TileMapEvents[TEventName]
Returns void
publicflagCollidersDirty
Returns void
publicflagTilesDirty
Returns void
inheritedget
Type parameters
- TComponent: Component
Parameters
type: ComponentCtor<TComponent>
Returns MaybeKnownComponent<TComponent, any>
publicinheritedgetAncestors
Returns a list of parent entities starting with the topmost parent. Includes the current entity.
Returns Entity<any>[]
publicgetColumns
Returns readonly Tile[][]
publicinheritedgetComponents
Returns all component instances on entity
Returns Component[]
publicgetCompositeCollider
Returns the CompositeCollider
Returns CompositeCollider
publicinheritedgetDescendants
Returns a list of all the entities that descend from this entity. Includes the current entity.
Returns Entity<any>[]
publicgetOnScreenTiles
Returns the on screen tiles for a tilemap, this will overshoot by a small amount because of the internal quad tree data structure.
Useful if you need to perform specific logic on onscreen tiles
Returns readonly Tile[]
publicgetRows
Returns readonly Tile[][]
publicgetTile
publicgetTileByIndex
publicgetTileByPoint
publicinheritedhas
Check if a component type exists
Type parameters
- TComponent: Component
Parameters
type: ComponentCtor<TComponent>
Returns boolean
inheritedhasAll
Verifies that an entity has all the required types
Type parameters
- TComponent: Component
Parameters
requiredTypes: ComponentCtor<TComponent>[]
Returns boolean
inheritedhasAllTags
Verifies that an entity has all the required tags
Parameters
requiredTags: string[]
Returns boolean
publicinheritedhasChild
Check if a child entity exists on the parent entity
Parameters
child: Entity
entity to check for
recursive: boolean = false
whether to check recursively
Returns boolean
publicinheritedhasTag
Check if a tag exists on the entity
Parameters
tag: string
name to check for
Returns boolean
publicinheritedisKilled
Returns boolean
publicinheritedkill
Kill the entity, means it will no longer be updated. Kills are deferred to the end of the update. If parented it will be removed from the parent when killed.
Returns void
publicoff
Type parameters
- TEventName: EventKey<TileMapEvents>
Parameters
eventName: TEventName
handler: Handler<TileMapEvents[TEventName]>
Returns void
publicon
Type parameters
- TEventName: EventKey<TileMapEvents>
Parameters
eventName: TEventName
handler: Handler<TileMapEvents[TEventName]>
Returns Subscription
publicinheritedonAdd
onAddis called when Actor is added to scene. This method is meant to be overridden.Synonymous with the event handler
.on('add', (evt) => {...})Parameters
engine: Engine
Returns void
publiconce
Type parameters
- TEventName: EventKey<TileMapEvents>
Parameters
eventName: TEventName
handler: Handler<TileMapEvents[TEventName]>
Returns Subscription
publicinheritedonInitialize
onInitializeis called before the first update of the entity. This method is meant to be overridden.Synonymous with the event handler
.on('initialize', (evt) => {...})Parameters
engine: Engine
Returns void
publicinheritedonPostUpdate
Safe to override onPostUpdate lifecycle event handler. Synonymous with
.on('postupdate', (evt) =>{...})onPostUpdateis called directly after an entity is updated.Parameters
engine: Engine
elapsed: number
Returns void
publicinheritedonPreUpdate
Safe to override onPreUpdate lifecycle event handler. Synonymous with
.on('preupdate', (evt) =>{...})onPreUpdateis called directly before an entity is updated.Parameters
engine: Engine
elapsed: number
Returns void
publicinheritedonRemove
onRemoveis called when Actor is removed from a scene. This method is meant to be overridden.Synonymous with the event handler
.on('remove', (evt) => {...})Parameters
engine: Engine
Returns void
publicinheritedremoveAllChildren
Removes all children from this entity
Returns Entity
publicinheritedremoveChild
publicinheritedremoveComponent
Removes a component from the entity, by default removals are deferred to the end of entity update to avoid consistency issues
Components can be force removed with the
forceflag, the removal is not deferred and happens immediatelyType parameters
- TComponent: Component
Parameters
typeOrInstance: TComponent | ComponentCtor<TComponent>
force: boolean = false
Returns Entity<Exclude<any, TComponent>>
publicinheritedremoveTag
Removes a tag on the entity
Removals are deferred until the end of update
Parameters
tag: string
Returns Entity<any>
publicinheritedunparent
Unparents this entity, if there is a parent. Otherwise it does nothing.
Returns void
The TileMap provides a mechanism for doing flat 2D tiles rendered in a grid.
TileMaps are useful for top down or side scrolling grid oriented games.