TilemapComponent
Defined in: tilemap/src/TilemapComponent.ts:51
Component that renders a Tiled map using @pixi/tilemap.
Extends
Section titled “Extends”Component
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TilemapComponent(
options):TilemapComponent
Defined in: tilemap/src/TilemapComponent.ts:65
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”TilemapComponent
Overrides
Section titled “Overrides”Component.constructor
Properties
Section titled “Properties”container
Section titled “container”
readonlycontainer:Container
Defined in: tilemap/src/TilemapComponent.ts:52
readonlydata:TilemapData
Defined in: tilemap/src/TilemapComponent.ts:53
enabled
Section titled “enabled”enabled:
boolean
Defined in: core/dist/index.d.ts:1731
Whether this component is active. Disabled components are skipped by ComponentUpdateSystem.
Inherited from
Section titled “Inherited from”Component.enabled
entity
Section titled “entity”entity:
Entity
Defined in: core/dist/index.d.ts:1729
Back-reference to the owning entity. Set by the engine when the component is added to an entity. Do not set manually.
Inherited from
Section titled “Inherited from”Component.entity
keyPrefix
Section titled “keyPrefix”
readonlykeyPrefix:string|null
Defined in: tilemap/src/TilemapComponent.ts:57
Prefix used to derive auto-keys for entities spawned from objects.
mapKey
Section titled “mapKey”
readonlymapKey:string|null
Defined in: tilemap/src/TilemapComponent.ts:55
Asset path of this map, or null if constructed from a raw TiledMapData without one.
Accessors
Section titled “Accessors”context
Section titled “context”Get Signature
Section titled “Get Signature”get context():
EngineContext
Defined in: core/dist/index.d.ts:1744
Access the EngineContext from the entity’s scene. Throws if the entity is not in a scene.
Returns
Section titled “Returns”EngineContext
Inherited from
Section titled “Inherited from”Component.context
heightPx
Section titled “heightPx”Get Signature
Section titled “Get Signature”get heightPx():
number
Defined in: tilemap/src/TilemapComponent.ts:157
Map height in pixels.
Returns
Section titled “Returns”number
Get Signature
Section titled “Get Signature”get scene():
Scene
Defined in: core/dist/index.d.ts:1739
Access the entity’s scene. Throws if the entity is not in a scene.
Prefer this over threading through this.entity.scene in component
code.
Returns
Section titled “Returns”Scene
Inherited from
Section titled “Inherited from”Component.scene
tileHeight
Section titled “tileHeight”Get Signature
Section titled “Get Signature”get tileHeight():
number
Defined in: tilemap/src/TilemapComponent.ts:167
Tile height in pixels.
Returns
Section titled “Returns”number
tileWidth
Section titled “tileWidth”Get Signature
Section titled “Get Signature”get tileWidth():
number
Defined in: tilemap/src/TilemapComponent.ts:162
Tile width in pixels.
Returns
Section titled “Returns”number
widthPx
Section titled “widthPx”Get Signature
Section titled “Get Signature”get widthPx():
number
Defined in: tilemap/src/TilemapComponent.ts:152
Map width in pixels.
Returns
Section titled “Returns”number
Methods
Section titled “Methods”_runCleanups()
Section titled “_runCleanups()”_runCleanups():
void
Defined in: core/dist/index.d.ts:1785
Internal
Run and clear all registered cleanups. Called by Entity.remove() and Entity._performDestroy() before onRemove/onDestroy.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Component._runCleanups
addCleanup()
Section titled “addCleanup()”
protectedaddCleanup(fn):void
Defined in: core/dist/index.d.ts:1779
Register a cleanup function to run when this component is removed or destroyed.
Parameters
Section titled “Parameters”() => void
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Component.addCleanup
afterRestore()?
Section titled “afterRestore()?”
optionalafterRestore(data,resolve):void
Defined in: core/dist/index.d.ts:1799
Called after onAdd() during save/load restoration. Apply state that depends on onAdd() having run.
Parameters
Section titled “Parameters”unknown
resolve
Section titled “resolve”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Component.afterRestore
findObject()
Section titled “findObject()”findObject(
id):MapObject|undefined
Defined in: tilemap/src/TilemapComponent.ts:282
Find an object by its Tiled id. Searches every object layer.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”MapObject | undefined
findObjectByName()
Section titled “findObjectByName()”findObjectByName(
name):MapObject|undefined
Defined in: tilemap/src/TilemapComponent.ts:292
Find the first object with a matching name. Searches every object layer.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”MapObject | undefined
fixedUpdate()?
Section titled “fixedUpdate()?”
optionalfixedUpdate(dt):void
Defined in: core/dist/index.d.ts:1795
Called every fixed timestep by the built-in ComponentUpdateSystem.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Component.fixedUpdate
forEachObject()
Section titled “forEachObject()”forEachObject(
layerName,fn):void
Defined in: tilemap/src/TilemapComponent.ts:252
Iterate every object on the given layer (or every layer if omitted),
passing the auto-derived stable key alongside each object so callers can
spawn entities with scene.spawn(Class, params, { key }).
Skips objects that don’t have a key prefix (component constructed from raw
map: without mapKey or keyPrefix) — those callers should iterate
getObjects directly.
Parameters
Section titled “Parameters”layerName
Section titled “layerName”string | undefined
(obj, key) => void
Returns
Section titled “Returns”void
getAllObjects()
Section titled “getAllObjects()”getAllObjects():
MapObject[]
Defined in: tilemap/src/TilemapComponent.ts:233
Flat list of every object across every object layer. Memoized — safe because parsed map data is immutable post-construction.
Returns
Section titled “Returns”getCollisionShapes()
Section titled “getCollisionShapes()”getCollisionShapes(
objectLayerName?):TilemapColliderConfig[]
Defined in: tilemap/src/TilemapComponent.ts:207
Extract physics-agnostic collision shapes from object layers.
Parameters
Section titled “Parameters”objectLayerName?
Section titled “objectLayerName?”string
Returns
Section titled “Returns”getObjects()
Section titled “getObjects()”getObjects(
objectLayerName?):Record<string,MapObject[]>
Defined in: tilemap/src/TilemapComponent.ts:212
Objects from object layers grouped by class ?? name. Use a layer name to scope.
Parameters
Section titled “Parameters”objectLayerName?
Section titled “objectLayerName?”string
Returns
Section titled “Returns”Record<string, MapObject[]>
getProperty()
Section titled “getProperty()”getProperty<
T>(obj,name):T|undefined
Defined in: tilemap/src/TilemapComponent.ts:302
Read a typed custom property off any tilemap object.
Type Parameters
Section titled “Type Parameters”T = unknown
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”T | undefined
getPropertyArray()
Section titled “getPropertyArray()”getPropertyArray<
T>(obj,name):T[]
Defined in: tilemap/src/TilemapComponent.ts:307
Read an indexed property bag (name[0], name[1], …) as an array.
Type Parameters
Section titled “Type Parameters”T = unknown
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”T[]
getTileAt()
Section titled “getTileAt()”getTileAt(
worldX,worldY,layerName?):number|null
Defined in: tilemap/src/TilemapComponent.ts:175
Returns the tile GID at a world position, accounting for entity Transform offset. Returns null if the position is outside the map or the tile is empty.
Parameters
Section titled “Parameters”worldX
Section titled “worldX”number
worldY
Section titled “worldY”number
layerName?
Section titled “layerName?”string
Returns
Section titled “Returns”number | null
listen()
Section titled “listen()”
protectedlisten<T>(entity,token,handler):void
Defined in: core/dist/index.d.ts:1771
Subscribe to events on any entity, auto-unsubscribe on removal.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”entity
Section titled “entity”Entity
EventToken<T>
handler
Section titled “handler”(data) => void
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Component.listen
listenScene()
Section titled “listenScene()”
protectedlistenScene<T>(token,handler):void
Defined in: core/dist/index.d.ts:1777
Subscribe to scene-level events, auto-unsubscribe on removal. Handlers
fire for bubbled entity events (entity = source) and scene.emit
events (entity = undefined).
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”EventToken<T>
handler
Section titled “handler”(data, entity?) => void
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Component.listenScene
objectKey()
Section titled “objectKey()”objectKey(
obj):string
Defined in: tilemap/src/TilemapComponent.ts:272
Auto-derived stable key for an object: <keyPrefix>#object:<id>.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”string
onAdd()
Section titled “onAdd()”onAdd():
void
Defined in: tilemap/src/TilemapComponent.ts:109
Called when the component is added to an entity.
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”Component.onAdd
onDestroy()
Section titled “onDestroy()”onDestroy():
void
Defined in: tilemap/src/TilemapComponent.ts:119
Called when the component is destroyed (entity destroyed or component removed).
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”Component.onDestroy
onRemove()?
Section titled “onRemove()?”
optionalonRemove():void
Defined in: core/dist/index.d.ts:1789
Called when the component is removed from an entity.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Component.onRemove
resolveRef()
Section titled “resolveRef()”resolveRef(
obj,propName):MapObject|undefined
Defined in: tilemap/src/TilemapComponent.ts:315
Resolve a Tiled object-reference property to the actual object. Auto-collects across every layer so callers don’t have to.
Parameters
Section titled “Parameters”propName
Section titled “propName”string
Returns
Section titled “Returns”MapObject | undefined
resolveRefArray()
Section titled “resolveRefArray()”resolveRefArray(
obj,propName):MapObject[]
Defined in: tilemap/src/TilemapComponent.ts:320
Same as resolveRef, but for indexed object-reference arrays.
Parameters
Section titled “Parameters”propName
Section titled “propName”string
Returns
Section titled “Returns”serialize()
Section titled “serialize()”serialize():
TilemapComponentData|null
Defined in: tilemap/src/TilemapComponent.ts:124
Return a JSON-serializable snapshot of this component’s state. Used by the save system.
Returns
Section titled “Returns”TilemapComponentData | null
Overrides
Section titled “Overrides”Component.serialize
service()
Section titled “service()”
protectedservice<T>(key):T
Defined in: core/dist/index.d.ts:1761
Lazy proxy-based service resolution. Can be used at field-declaration time:
readonly input = this.service(InputManagerKey);The actual resolution is deferred until first property access.
Type Parameters
Section titled “Type Parameters”T extends object
Parameters
Section titled “Parameters”ServiceKey<T>
Returns
Section titled “Returns”T
Inherited from
Section titled “Inherited from”Component.service
sibling()
Section titled “sibling()”
protectedsibling<C>(cls):C
Defined in: core/dist/index.d.ts:1769
Lazy proxy-based sibling component resolution. Can be used at field-declaration time:
readonly anim = this.sibling(AnimatedSpriteComponent);The actual resolution is deferred until first property access.
Type Parameters
Section titled “Type Parameters”C extends Component
Parameters
Section titled “Parameters”ComponentClass<C>
Returns
Section titled “Returns”C
Inherited from
Section titled “Inherited from”Component.sibling
update()?
Section titled “update()?”
optionalupdate(dt):void
Defined in: core/dist/index.d.ts:1793
Called every frame by the built-in ComponentUpdateSystem.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Component.update
protecteduse<T>(key):T
Defined in: core/dist/index.d.ts:1752
Resolve a service by key, cached after first lookup. Scene-scoped values
(registered via scene._registerScoped) take precedence over engine
scope. A key declared with scope: "scene" that falls back to engine
scope emits a one-shot dev warning — almost always signals a missed
beforeEnter hook.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”ServiceKey<T>
Returns
Section titled “Returns”T
Inherited from
Section titled “Inherited from”Component.use
fromSnapshot()
Section titled “fromSnapshot()”
staticfromSnapshot(data):TilemapComponent
Defined in: tilemap/src/TilemapComponent.ts:142
Parameters
Section titled “Parameters”Returns
Section titled “Returns”TilemapComponent