IsometricTile
Hierarchy
- Entity
- IsometricTile
Index
Constructors
Properties
Accessors
Methods
- addChild
- addCollider
- addComponent
- addGraphic
- addTag
- addTemplate
- clearColliders
- clearComponents
- clearGraphics
- clone
- draw
- emit
- get
- getAncestors
- getColliders
- getComponents
- getDescendants
- getGraphics
- has
- hasAll
- hasAllTags
- hasChild
- hasTag
- isKilled
- kill
- off
- on
- onAdd
- once
- onInitialize
- onPostUpdate
- onPreUpdate
- onRemove
- removeAllChildren
- removeChild
- removeCollider
- removeComponent
- removeGraphic
- removeTag
- unparent
Constructors
constructor
Construct a new IsometricTile
Parameters
x: number
tile coordinate in x (not world position)
y: number
tile coordinate in y (not world position)
graphicsOffset: Vector | null
offset that tile should be shifted by (default (0, 0))
map: IsometricMap
reference to owning IsometricMap
Returns IsometricTile
Properties
publicinherited_componentsToRemove
publicinheritedchildrenAdded$
publicinheritedchildrenRemoved$
publicinheritedcomponentAdded$
publicinheritedcomponentRemoved$
publicreadonlyinheritedcomponents
Current components on the entity
Do not modify
Use addComponent/removeComponent otherwise the ECS will not be notified of changes.
publicinheritedcomponentValues
publicdata
Arbitrary data storage per tile, useful for any game specific data
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
publicreadonlymap
Reference to the IsometricMap this tile is part of
publicinheritedname
publicinheritedscene
The current scene that the entity is in, if any
publicsolid
Indicates whether this tile is solid
publicinheritedtagAdded$
publicinheritedtagRemoved$
publicreadonlyx
Integer tile x coordinate
publicreadonlyy
Integer tile y coordinate
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
publiccenter
Returns the center of the IsometricTile
Returns Vector
publicinheritedchildren
Get the direct children of this entity
Returns readonly Entity<any>[]
publicinheritedisAdded
Returns boolean
publicinheritedisInitialized
Gets whether the actor is Initialized
Returns boolean
publicinheritedparent
Returns Entity<any> | null
publicpos
Returns the top left corner of the IsometricTile in world space
Returns Vector
publicinheritedtags
Specifically get the tags on the entity from TagsComponent
Returns Set<string>
publicinheritedtypes
The types of the components on the Entity
Returns ComponentCtor[]
Methods
publicinheritedaddChild
publicaddCollider
Adds a collider to the IsometricTile
Note! the Tile.solid must be set to true for it to act as a "fixed" collider
Parameters
collider: Collider
Returns void
publicinheritedaddComponent
publicaddGraphic
publicinheritedaddTag
Adds a tag to an entity
Parameters
tag: string
Returns Entity<any>
publicinheritedaddTemplate
publicclearColliders
Clears all colliders from the IsometricTile
Returns void
publicinheritedclearComponents
Returns void
publicclearGraphics
Returns void
publicinheritedclone
Creates a deep copy of the entity and a copy of all its components
Returns Entity
draw
Parameters
gfx: ExcaliburGraphicsContext
_elapsed: number
Returns void
publicinheritedemit
Type parameters
- TEventName: EventKey<EntityEvents>
Parameters
eventName: TEventName
event: EntityEvents[TEventName]
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>[]
publicgetColliders
Returns readonly Collider[]
publicinheritedgetComponents
Returns all component instances on entity
Returns Component[]
publicinheritedgetDescendants
Returns a list of all the entities that descend from this entity. Includes the current entity.
Returns Entity<any>[]
publicgetGraphics
Returns readonly Graphic[]
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
publicinheritedoff
Type parameters
- TEventName: EventKey<EntityEvents>
Parameters
eventName: TEventName
handler: Handler<EntityEvents[TEventName]>
Returns void
publicinheritedon
Type parameters
- TEventName: EventKey<EntityEvents>
Parameters
eventName: TEventName
handler: Handler<EntityEvents[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
publicinheritedonce
Type parameters
- TEventName: EventKey<EntityEvents>
Parameters
eventName: TEventName
handler: Handler<EntityEvents[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
publicremoveCollider
Removes a collider from the IsometricTile
Parameters
collider: Collider
Returns void
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>>
publicremoveGraphic
Parameters
graphic: Graphic
Returns void
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
An Entity is the base type of anything that can have behavior in Excalibur, they are part of the built in entity component system
Entities can be strongly typed with the components they contain