CameraEntity
Defined in: renderer/src/CameraEntity.ts:100
Camera entity. Spawn in a scene to enable camera-based layer transforms.
const cam = this.spawn(CameraEntity, { follow: player.get(Transform), smoothing: 0.15, bounds: { minX: 0, minY: 0, maxX: 2000, maxY: 2000 },});
// All camera operations are available directly on the entity:cam.shake(8, 0.3);cam.zoomTo(1.5, 1);cam.follow(otherTarget, { smoothing: 0.1 });Extends
Section titled “Extends”Entity
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CameraEntity(
name?,tags?):CameraEntity
Defined in: core/dist/index.d.ts:362
Parameters
Section titled “Parameters”string
Iterable<string, any, any>
Returns
Section titled “Returns”CameraEntity
Inherited from
Section titled “Inherited from”Entity.constructor
Properties
Section titled “Properties”fixedUpdate?
Section titled “fixedUpdate?”
readonlyoptionalfixedUpdate?:undefined
Defined in: core/dist/index.d.ts:334
Reserved: a subclass that declares fixedUpdate fails to compile.
There is no fixed-step entity hook either, and for the same reason. Both
homes above apply: a component added to the entity, or a process on the
queue that makeSceneScopedQueue() returns when the work outlives a
single entity.
The slot is optional, so the compiler reports the subclass method as not
assignable to type undefined rather than to type never.
Inherited from
Section titled “Inherited from”Entity.fixedUpdate
readonlyid:number
Defined in: core/dist/index.d.ts:285
Unique auto-incrementing ID.
Inherited from
Section titled “Inherited from”Entity.id
readonlyoptionalkey?:string
Defined in: core/dist/index.d.ts:296
Stable identity key, scene-scoped. Set at spawn-time when
options.key is passed to scene.spawn / entity.spawnChild;
undefined otherwise. Used with scene.findByKey and as a stable
id in reactive stores (e.g. a createSet<string>() persisted under "world.opened").
Inherited from
Section titled “Inherited from”Entity.key
readonlyname:string
Defined in: core/dist/index.d.ts:287
Display name for debugging.
Inherited from
Section titled “Inherited from”Entity.name
readonlytags:Set<string>
Defined in: core/dist/index.d.ts:289
Tags for group queries.
Inherited from
Section titled “Inherited from”Entity.tags
timeScale
Section titled “timeScale”timeScale:
number
Defined in: core/dist/index.d.ts:310
Per-entity time-scale multiplier. Mirrors Scene.timeScale but
scoped to this single entity: the engine composes the delta time passed
to this entity’s components (and its ProcessComponent, particle
emitters) as dt * scene.timeScale * entity.timeScale. 1 = normal
speed, 0.5 = half speed, 0 = frozen, 2 = double speed.
Physics is deliberately NOT affected: PhysicsSystem steps a single
shared Rapier world per scene under scene.timeScale only, so a
rigid-body entity’s simulation cannot be individually slowed or sped up
via this field. Use a kinematic body or scale velocities manually if you
need per-body time control.
Inherited from
Section titled “Inherited from”Entity.timeScale
update?
Section titled “update?”
readonlyoptionalupdate?:undefined
Defined in: core/dist/index.d.ts:322
Reserved: a subclass that declares update fails to compile.
The engine’s per-frame pass ticks the components an entity holds, so an
entity method with this name is dead code. Per-frame logic belongs in a
component added to the entity, or in a process on the queue that
makeSceneScopedQueue() returns when the work outlives a single entity.
The slot is optional, so the compiler reports the subclass method as not
assignable to type undefined rather than to type never.
Inherited from
Section titled “Inherited from”Entity.update
[TRAITS_KEY]
Section titled “[TRAITS_KEY]”
static[TRAITS_KEY]:Set<symbol>
Defined in: core/dist/index.d.ts:283
Inherited from
Section titled “Inherited from”Entity.[TRAITS_KEY]
Accessors
Section titled “Accessors”activeSelf
Section titled “activeSelf”Get Signature
Section titled “Get Signature”get activeSelf():
boolean
Defined in: core/dist/index.d.ts:441
This entity’s own activeness bit — what setActive last wrote. An entity
whose activeSelf is true can still be dormant, if an ancestor is not.
Use isActive for the state the engine acts on.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”Entity.activeSelf
bounds
Section titled “bounds”Get Signature
Section titled “Get Signature”get bounds():
CameraBounds|undefined
Defined in: renderer/src/CameraEntity.ts:189
Returns
Section titled “Returns”CameraBounds | undefined
Set Signature
Section titled “Set Signature”set bounds(
value):void
Defined in: renderer/src/CameraEntity.ts:193
Parameters
Section titled “Parameters”CameraBounds | undefined
Returns
Section titled “Returns”void
children
Section titled “children”Get Signature
Section titled “Get Signature”get children():
ReadonlyMap<string,Entity>
Defined in: core/dist/index.d.ts:475
Named children as a read-only map. Empty map if no children.
Returns
Section titled “Returns”ReadonlyMap<string, Entity>
Inherited from
Section titled “Inherited from”Entity.children
effectivePosition
Section titled “effectivePosition”Get Signature
Section titled “Get Signature”get effectivePosition():
Vec2
Defined in: renderer/src/CameraEntity.ts:197
Returns
Section titled “Returns”Vec2
effectiveRotation
Section titled “effectiveRotation”Get Signature
Section titled “Get Signature”get effectiveRotation():
number
Defined in: renderer/src/CameraEntity.ts:201
Returns
Section titled “Returns”number
effectiveZoom
Section titled “effectiveZoom”Get Signature
Section titled “Get Signature”get effectiveZoom():
number
Defined in: renderer/src/CameraEntity.ts:205
Returns
Section titled “Returns”number
generation
Section titled “generation”Get Signature
Section titled “Get Signature”get generation():
number
Defined in: core/dist/index.d.ts:392
Which life of this entity is current. An EntityPool member is reused, so one object serves many lives; the counter moves on whenever a life ends, by release or by destruction. handle compares against it. Compare for equality only — a destruction cascade can advance it more than once, so it does not count lives. Written by the engine only.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”Entity.generation
isActive
Section titled “isActive”Get Signature
Section titled “Get Signature”get isActive():
boolean
Defined in: core/dist/index.d.ts:448
Whether the entity is active: its own activeSelf and every ancestor’s.
A dormant entity keeps all of its components and its place in
scene.getEntities(), but drops out of queries, findEntity,
findEntitiesByTag and findEntities, and its components stop updating.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”Entity.isActive
isDestroyed
Section titled “isDestroyed”Get Signature
Section titled “Get Signature”get isDestroyed():
boolean
Defined in: core/dist/index.d.ts:382
True once the entity is dead — after destroy() is called, or once its
scene starts tearing it down on scene exit.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”Entity.isDestroyed
isPooled
Section titled “isPooled”Get Signature
Section titled “Get Signature”get isPooled():
boolean
Defined in: core/dist/index.d.ts:384
True while an EntityPool owns this entity.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”Entity.isPooled
modifiers
Section titled “modifiers”Get Signature
Section titled “Get Signature”get modifiers():
CameraModifierHost
Defined in: renderer/src/CameraEntity.ts:209
Returns
Section titled “Returns”parent
Section titled “parent”Get Signature
Section titled “Get Signature”get parent():
Entity|null
Defined in: core/dist/index.d.ts:473
The parent entity, or null if this is a root entity. A child created by
Entity.spawnChild reads null until that call returns, so its
setup() cannot reach the parent through it.
Returns
Section titled “Returns”Entity | null
Inherited from
Section titled “Inherited from”Entity.parent
position
Section titled “position”Get Signature
Section titled “Get Signature”get position():
Vec2
Defined in: renderer/src/CameraEntity.ts:165
Returns
Section titled “Returns”Vec2
Set Signature
Section titled “Set Signature”set position(
value):void
Defined in: renderer/src/CameraEntity.ts:169
Parameters
Section titled “Parameters”Vec2
Returns
Section titled “Returns”void
rotation
Section titled “rotation”Get Signature
Section titled “Get Signature”get rotation():
number
Defined in: renderer/src/CameraEntity.ts:181
Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set rotation(
value):void
Defined in: renderer/src/CameraEntity.ts:185
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Get Signature
Section titled “Get Signature”get scene():
Scene
Defined in: core/dist/index.d.ts:375
The scene this entity belongs to. Throws if the entity is not attached
to a scene — which in practice only happens before scene.spawn /
addChild wires it up, or after the entity is destroyed (end-of-frame
flush after destroy(), or scene teardown on exit). Inside lifecycle
methods (setup, component onAdd, update, and component
onDestroy during destruction) this is always safe to access.
For the rare case where you genuinely need to inspect whether an
entity has a scene (e.g. defensive code in systems iterating a query
result), use tryScene instead.
Returns
Section titled “Returns”Scene
Inherited from
Section titled “Inherited from”Entity.scene
tryScene
Section titled “tryScene”Get Signature
Section titled “Get Signature”get tryScene():
Scene|null
Defined in: core/dist/index.d.ts:377
The scene this entity belongs to, or null if detached.
Returns
Section titled “Returns”Scene | null
Inherited from
Section titled “Inherited from”Entity.tryScene
Get Signature
Section titled “Get Signature”get zoom():
number
Defined in: renderer/src/CameraEntity.ts:173
Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set zoom(
value):void
Defined in: renderer/src/CameraEntity.ts:177
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Methods
Section titled “Methods”_componentsInUpdateOrder()
Section titled “_componentsInUpdateOrder()”_componentsInUpdateOrder():
Iterable<Component>
Defined in: core/dist/index.d.ts:566
Internal
Internal: components in the order ComponentUpdateSystem calls them —
ascending updatePriority, ties in add order. Identical to getAll()
until a component declares a priority. The sorted array is replaced, not
mutated, when a component is added or removed, so a pass already
iterating it finishes over the old order; a component added mid-pass
first runs next frame. The map iterator on the default path is live, so
there a component added mid-pass can run in the same pass.
Returns
Section titled “Returns”Iterable<Component>
Inherited from
Section titled “Inherited from”Entity._componentsInUpdateOrder
_deactivateForDestroy()
Section titled “_deactivateForDestroy()”_deactivateForDestroy():
void
Defined in: core/dist/index.d.ts:622
Internal
Internal: deactivate immediately without touching activeSelf,
mirroring what destroy() does per-entity. Used by Scene when it
tears down every entity at once — idempotent, and safe to call in any
order across a flat entity set: an entity already reached through a
parent’s cascade is a no-op here.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity._deactivateForDestroy
_destroyOwned()
Section titled “_destroyOwned()”_destroyOwned():
void
Defined in: core/dist/index.d.ts:593
Internal
Internal: destroy for real, skipping the pool redirect. Used by the owning pool when it disposes, and by the cascade below.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity._destroyOwned
_detachFromParent()
Section titled “_detachFromParent()”_detachFromParent():
void
Defined in: core/dist/index.d.ts:649
Internal
Internal: detach from whatever parent this entity has, without touching
children or activeness. Shared by _performDestroy, the pooled-child
branch of _destroyOwned’s cascade, and EntityPool.stow, which parks a
released member that picked up a parent mid-lease. Unlike removeChild,
this does not resync activeness — callers that need activeSelf
honoured against no parent still call setActive/_resyncActive
themselves.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity._detachFromParent
_endLife()
Section titled “_endLife()”_endLife():
void
Defined in: core/dist/index.d.ts:638
Internal
Internal: end this life so handles taken during it stop resolving. The
subtree follows, because it is released or destroyed with this entity.
Called by EntityPool when a lease ends; destruction goes through
_markDestroyed instead.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity._endLife
_invalidateUpdateOrder()
Section titled “_invalidateUpdateOrder()”_invalidateUpdateOrder(
component):void
Defined in: core/dist/index.d.ts:574
Internal
Internal: a component was added or its updatePriority was written.
Switches the entity onto the sorted update path once any component
leaves the default priority, and drops the cached order so the next
update pass rebuilds it.
Parameters
Section titled “Parameters”component
Section titled “component”Component
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity._invalidateUpdateOrder
_markDestroyed()
Section titled “_markDestroyed()”_markDestroyed():
void
Defined in: core/dist/index.d.ts:630
Internal
Internal: mark the entity destroyed without queueing it. Called by Scene
during teardown so every entity reads isDestroyed === true before any
component onDestroy runs, and by _destroyOwned. Idempotent, and the
one place a destruction ends a life.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity._markDestroyed
_markPooled()
Section titled “_markPooled()”_markPooled(
owner):void
Defined in: core/dist/index.d.ts:435
Internal
Internal: mark the entity as a pool member. Called by EntityPool when
it constructs one.
Parameters
Section titled “Parameters”EntityPoolOwner
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity._markPooled
_performDestroy()
Section titled “_performDestroy()”_performDestroy(
onError?):void
Defined in: core/dist/index.d.ts:655
Internal
Internal: perform actual destruction — remove all components and clear state. Called by Scene during endOfFrame flush.
Parameters
Section titled “Parameters”onError?
Section titled “onError?”(error) => void
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity._performDestroy
_resyncActive()
Section titled “_resyncActive()”_resyncActive():
void
Defined in: core/dist/index.d.ts:599
Internal
Internal: recompute effective activeness against the current parent and
propagate to descendants. Called after setActive and after a re-parent.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity._resyncActive
_setActiveSuppressed()
Section titled “_setActiveSuppressed()”_setActiveSuppressed(
activeSelf):void
Defined in: core/dist/index.d.ts:606
Internal
Internal: write activeSelf and park the entity as dormant without
firing hooks or touching queries. Pools and dormant-parent child spawns
use this to avoid transient query membership and enable hooks.
Parameters
Section titled “Parameters”activeSelf
Section titled “activeSelf”boolean
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity._setActiveSuppressed
_setKey()
Section titled “_setKey()”_setKey(
key):void
Defined in: core/dist/index.d.ts:703
Internal
Internal: assign the stable identity key. Called by Scene._registerKey
during spawn. Throws if the entity already has a key — keys are
immutable for an entity’s lifetime.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity._setKey
_setScene()
Section titled “_setScene()”_setScene(
scene,callbacks):void
Defined in: core/dist/index.d.ts:696
Internal
Internal: set the scene and callbacks. Called by Scene.spawn().
Parameters
Section titled “Parameters”Scene | null
callbacks
Section titled “callbacks”EntityCallbacks | null
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity._setScene
add<
C>(component):C
Defined in: core/dist/index.d.ts:514
Add a component instance. Returns the component for chaining.
Type Parameters
Section titled “Type Parameters”C extends Component
Parameters
Section titled “Parameters”component
Section titled “component”C
Returns
Section titled “Returns”C
Inherited from
Section titled “Inherited from”Entity.add
addChild()
Section titled “addChild()”addChild(
name,child):void
Defined in: core/dist/index.d.ts:480
Add a named child entity. Auto-adds to parent’s scene if not already in one; a child that belongs to a different scene is rejected.
Parameters
Section titled “Parameters”string
Entity
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity.addChild
destroy()
Section titled “destroy()”destroy():
void
Defined in: core/dist/index.d.ts:587
Retire the entity. Leaves its queries immediately — isActive reads
false and component onDisable fires right away — with the rest of
teardown (onDestroy, detach from scene) deferred to the end-of-frame
flush.
A pool member is retired by going back to its pool instead — its pool
owns its lifetime and destroys it only when the pool itself is disposed.
That keeps destroy() usable from the places retirement is actually
decided: a collision handler, an update, an event listener, all of which
see a plain Entity and hold no pool reference.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity.destroy
emit()
Section titled “emit()”Call Signature
Section titled “Call Signature”emit(
token):void
Defined in: core/dist/index.d.ts:543
Emit a typed event on this entity. Bubbles to the scene.
Parameters
Section titled “Parameters”EventToken<void>
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity.emit
Call Signature
Section titled “Call Signature”emit<
T>(token,data):void
Defined in: core/dist/index.d.ts:544
Emit a typed event on this entity. Bubbles to the scene.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”EventToken<T>
T
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity.emit
follow()
Section titled “follow()”follow(
target,options?):void
Defined in: renderer/src/CameraEntity.ts:217
Parameters
Section titled “Parameters”target
Section titled “target”options?
Section titled “options?”Returns
Section titled “Returns”void
get<
C>(cls):C
Defined in: core/dist/index.d.ts:521
Get a component by class. An exact match wins; otherwise the single
component assignable to cls is returned. Throws when nothing matches,
and when several components are assignable to cls — use
Entity.getAll for that case.
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”Entity.get
getAll()
Section titled “getAll()”Call Signature
Section titled “Call Signature”getAll():
Iterable<Component>
Defined in: core/dist/index.d.ts:546
Get all components as an iterable, in add order.
Returns
Section titled “Returns”Iterable<Component>
Inherited from
Section titled “Inherited from”Entity.getAll
Call Signature
Section titled “Call Signature”getAll<
C>(cls): readonlyC[]
Defined in: core/dist/index.d.ts:555
Every component assignable to cls — the class itself and any subclass —
in add order. The returned array is a read-only view of the entity’s
index: removing a component replaces the list rather than mutating it, so
a walk already in flight visits every member it started with. Adding one
appends to the live list, so a walk in flight also visits a component
added during it.
Type Parameters
Section titled “Type Parameters”C extends Component
Parameters
Section titled “Parameters”ComponentClass<C>
Returns
Section titled “Returns”readonly C[]
Inherited from
Section titled “Inherited from”Entity.getAll
getChild()
Section titled “getChild()”getChild(
name):Entity
Defined in: core/dist/index.d.ts:510
Get a child by name. Throws if not found.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Entity
Inherited from
Section titled “Inherited from”Entity.getChild
getEffectivePositionInto()
Section titled “getEffectivePositionInto()”getEffectivePositionInto(
out):Vec2Buffer
Defined in: renderer/src/CameraEntity.ts:245
Parameters
Section titled “Parameters”Vec2Buffer
Returns
Section titled “Returns”Vec2Buffer
handle()
Section titled “handle()”handle():
EntityHandle<CameraEntity>
Defined in: core/dist/index.d.ts:422
Capture a reference that expires with this entity’s current life, read
back through .current.
class Turret extends Entity { private target?: EntityHandle<Enemy>;
onSpotted(enemy: Enemy) { this.target = enemy.handle(); }
update() { const enemy = this.target?.current; // undefined once that enemy is gone if (enemy) this.aimAt(enemy); }}Take a handle whenever pooled entities are involved — a member can be retired from anywhere, so a stored plain reference goes stale silently. A plain reference is fine for entities that live as long as the scene, or when the code storing the reference also controls when the entity goes away.
A handle taken outside a live life never resolves: on a pool member (or an entity under one) whose pool is not currently lending it out, or on an entity that is destroyed or sits under a destroyed ancestor. In all of those the caller is holding a reference from a life that is already over.
Returns
Section titled “Returns”EntityHandle<CameraEntity>
Inherited from
Section titled “Inherited from”Entity.handle
has(
cls):boolean
Defined in: core/dist/index.d.ts:531
Check if entity has a component of the given class or any subclass of it.
Parameters
Section titled “Parameters”ComponentClass
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”Entity.has
hasTrait()
Section titled “hasTrait()”hasTrait<
T>(token):this is CameraEntity & T
Defined in: core/dist/index.d.ts:684
Check if this entity’s class implements a given trait. Acts as a type guard.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”TraitToken<T>
Returns
Section titled “Returns”this is CameraEntity & T
Inherited from
Section titled “Inherited from”Entity.hasTrait
on<
T>(token,handler): () =>void
Defined in: core/dist/index.d.ts:541
Subscribe to a typed event on this entity. Returns an unsubscribe function.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”EventToken<T>
handler
Section titled “handler”(data) => void
Returns
Section titled “Returns”() => void
Inherited from
Section titled “Inherited from”Entity.on
onAcquire()?
Section titled “onAcquire()?”
optionalonAcquire(…args):void
Defined in: core/dist/index.d.ts:675
Per-reuse reset, called by EntityPool every time the entity is
handed out — including the first time, right after setup(). Its
parameters become the pool’s acquire(...) arguments, so a bullet that
needs a position and a direction declares
onAcquire(x: number, y: number, dir: Vec2).
A pooled class must declare this hook: nothing else resets the state the
entity kept while dormant. Declare an empty one if there is genuinely
nothing to reset. It runs on a fully active entity, and must be
synchronous and non-overloaded — the pool derives acquire’s signature
from it, and a set of overloads keeps only the last.
Parameters
Section titled “Parameters”…unknown[]
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity.onAcquire
onRelease()?
Section titled “onRelease()?”
optionalonRelease():void
Defined in: core/dist/index.d.ts:682
Called by EntityPool when the entity is released, before it goes
dormant. Optional even for pooled classes: turning components off is the
job of onDisable, so this is for game-level cleanup — dropping a
target reference, clearing a listener registered outside setup().
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity.onRelease
remove()
Section titled “remove()”remove(
cls):void
Defined in: core/dist/index.d.ts:537
Remove the component of exactly this class. A base class is not
resolved here: remove(Base) does nothing when the entity holds only a
subclass, even though has(Base) is true. Remove the concrete class.
Parameters
Section titled “Parameters”ComponentClass
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity.remove
removeChild()
Section titled “removeChild()”removeChild(
name):Entity
Defined in: core/dist/index.d.ts:508
Remove a named child. Returns the detached entity.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Entity
Inherited from
Section titled “Inherited from”Entity.removeChild
requireKey()
Section titled “requireKey()”requireKey():
string
Defined in: core/dist/index.d.ts:691
Return the stable key, or throw if this entity was spawned without one.
Use it in the entity’s setup() or in a component’s onAdd() when the
code depends on identity (e.g. reading from a createSet keyed by entity
key). The spawn call assigns the key before setup() runs.
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”Entity.requireKey
screenToWorld()
Section titled “screenToWorld()”screenToWorld(
screenX,screenY):Vec2
Defined in: renderer/src/CameraEntity.ts:241
Parameters
Section titled “Parameters”screenX
Section titled “screenX”number
screenY
Section titled “screenY”number
Returns
Section titled “Returns”Vec2
screenToWorldInto()
Section titled “screenToWorldInto()”screenToWorldInto(
out,screenX,screenY):Vec2Buffer
Defined in: renderer/src/CameraEntity.ts:249
Parameters
Section titled “Parameters”Vec2Buffer
screenX
Section titled “screenX”number
screenY
Section titled “screenY”number
Returns
Section titled “Returns”Vec2Buffer
setActive()
Section titled “setActive()”setActive(
active):void
Defined in: core/dist/index.d.ts:467
Turn the entity on or off without destroying it. Descendants follow: a
child of a dormant entity is dormant whatever its own activeSelf says.
Components whose effective enabled-ness flips get onDisable /
onEnable. Per-component enabled flags are left alone, so a component
you disabled by hand stays disabled after the entity comes back.
bullet.setActive(false); // hidden, updates skippedbullet.get(Transform).setPosition(x, y);bullet.setActive(true); // back in play, no respawnAn entity with a RigidBodyComponent must be moved through
rb.setPosition(x, y) instead — physics owns the transform of a dynamic
body and overwrites a direct Transform write on the next frame.
Parameters
Section titled “Parameters”active
Section titled “active”boolean
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Entity.setActive
setup()
Section titled “setup()”setup(
params?):void
Defined in: renderer/src/CameraEntity.ts:103
Optional setup method. Called by scene.spawn(Class, params) after the
entity is wired to its scene, so components can access services.
Override in subclasses — do NOT use the constructor for component setup.
Parameters
Section titled “Parameters”params?
Section titled “params?”CameraEntityParams = {}
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”Entity.setup
shake()
Section titled “shake()”shake(
intensity,duration,options?):void
Defined in: renderer/src/CameraEntity.ts:229
Parameters
Section titled “Parameters”intensity
Section titled “intensity”number
duration
Section titled “duration”number
options?
Section titled “options?”Returns
Section titled “Returns”void
snapToTarget()
Section titled “snapToTarget()”snapToTarget():
void
Defined in: renderer/src/CameraEntity.ts:225
Returns
Section titled “Returns”void
spawnChild()
Section titled “spawnChild()”Call Signature
Section titled “Call Signature”spawnChild(
name,options?):Entity
Defined in: core/dist/index.d.ts:503
Spawn a new entity in this entity’s scene and add it as a named child.
Combines scene.spawn(...) + this.addChild(name, ...) in one call —
the idiomatic way to compose entity trees (logical root + visual body
- UI sibling + …).
Mirrors the overload shape of Scene.spawn: pass an Entity subclass
(with optional setup params), a Blueprint, or omit for an anonymous
base Entity.
The parent link is made after the child is built: child.parent is
null for the whole of its setup(), including the onAdd() of every
component that setup adds, and holds the parent once this call
returns. Pass the parent as a setup param when the child
needs it. To have setup() read this.parent, reserve both entities in
a scene.spawnBatch and call batch.addChild before batch.setup.
this.spawnChild("body", EnemyBody, { color: 0xff6b6b });this.spawnChild("hp", EnemyHealthBar);Parameters
Section titled “Parameters”string
options?
Section titled “options?”SpawnOptions
Returns
Section titled “Returns”Entity
Inherited from
Section titled “Inherited from”Entity.spawnChild
Call Signature
Section titled “Call Signature”spawnChild<
E>(name,Class, …rest):E
Defined in: core/dist/index.d.ts:504
Spawn a new entity in this entity’s scene and add it as a named child.
Combines scene.spawn(...) + this.addChild(name, ...) in one call —
the idiomatic way to compose entity trees (logical root + visual body
- UI sibling + …).
Mirrors the overload shape of Scene.spawn: pass an Entity subclass
(with optional setup params), a Blueprint, or omit for an anonymous
base Entity.
The parent link is made after the child is built: child.parent is
null for the whole of its setup(), including the onAdd() of every
component that setup adds, and holds the parent once this call
returns. Pass the parent as a setup param when the child
needs it. To have setup() read this.parent, reserve both entities in
a scene.spawnBatch and call batch.addChild before batch.setup.
this.spawnChild("body", EnemyBody, { color: 0xff6b6b });this.spawnChild("hp", EnemyHealthBar);Type Parameters
Section titled “Type Parameters”E extends Entity
Parameters
Section titled “Parameters”string
() => E
…ClassSpawnArgs<E>
Returns
Section titled “Returns”E
Inherited from
Section titled “Inherited from”Entity.spawnChild
Call Signature
Section titled “Call Signature”spawnChild<
P>(name,blueprint,params,options?):Entity
Defined in: core/dist/index.d.ts:505
Spawn a new entity in this entity’s scene and add it as a named child.
Combines scene.spawn(...) + this.addChild(name, ...) in one call —
the idiomatic way to compose entity trees (logical root + visual body
- UI sibling + …).
Mirrors the overload shape of Scene.spawn: pass an Entity subclass
(with optional setup params), a Blueprint, or omit for an anonymous
base Entity.
The parent link is made after the child is built: child.parent is
null for the whole of its setup(), including the onAdd() of every
component that setup adds, and holds the parent once this call
returns. Pass the parent as a setup param when the child
needs it. To have setup() read this.parent, reserve both entities in
a scene.spawnBatch and call batch.addChild before batch.setup.
this.spawnChild("body", EnemyBody, { color: 0xff6b6b });this.spawnChild("hp", EnemyHealthBar);Type Parameters
Section titled “Type Parameters”P
Parameters
Section titled “Parameters”string
blueprint
Section titled “blueprint”Blueprint<P>
params
Section titled “params”P
options?
Section titled “options?”SpawnOptions
Returns
Section titled “Returns”Entity
Inherited from
Section titled “Inherited from”Entity.spawnChild
Call Signature
Section titled “Call Signature”spawnChild(
name,blueprint,options?):Entity
Defined in: core/dist/index.d.ts:506
Spawn a new entity in this entity’s scene and add it as a named child.
Combines scene.spawn(...) + this.addChild(name, ...) in one call —
the idiomatic way to compose entity trees (logical root + visual body
- UI sibling + …).
Mirrors the overload shape of Scene.spawn: pass an Entity subclass
(with optional setup params), a Blueprint, or omit for an anonymous
base Entity.
The parent link is made after the child is built: child.parent is
null for the whole of its setup(), including the onAdd() of every
component that setup adds, and holds the parent once this call
returns. Pass the parent as a setup param when the child
needs it. To have setup() read this.parent, reserve both entities in
a scene.spawnBatch and call batch.addChild before batch.setup.
this.spawnChild("body", EnemyBody, { color: 0xff6b6b });this.spawnChild("hp", EnemyHealthBar);Parameters
Section titled “Parameters”string
blueprint
Section titled “blueprint”Blueprint<void>
options?
Section titled “options?”SpawnOptions
Returns
Section titled “Returns”Entity
Inherited from
Section titled “Inherited from”Entity.spawnChild
tryGet()
Section titled “tryGet()”tryGet<
C>(cls):C|undefined
Defined in: core/dist/index.d.ts:527
Get a component by class, or undefined if none matches. An exact match
wins; otherwise the single component assignable to cls is returned.
Throws when several are assignable — use Entity.getAll instead.
Type Parameters
Section titled “Type Parameters”C extends Component
Parameters
Section titled “Parameters”ComponentClass<C>
Returns
Section titled “Returns”C | undefined
Inherited from
Section titled “Inherited from”Entity.tryGet
tryGetChild()
Section titled “tryGetChild()”tryGetChild(
name):Entity|undefined
Defined in: core/dist/index.d.ts:512
Get a child by name, or undefined if not found.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Entity | undefined
Inherited from
Section titled “Inherited from”Entity.tryGetChild
unfollow()
Section titled “unfollow()”unfollow():
void
Defined in: renderer/src/CameraEntity.ts:221
Returns
Section titled “Returns”void
worldToScreen()
Section titled “worldToScreen()”worldToScreen(
worldX,worldY):Vec2
Defined in: renderer/src/CameraEntity.ts:265
Parameters
Section titled “Parameters”worldX
Section titled “worldX”number
worldY
Section titled “worldY”number
Returns
Section titled “Returns”Vec2
worldToScreenInto()
Section titled “worldToScreenInto()”worldToScreenInto(
out,worldX,worldY):Vec2Buffer
Defined in: renderer/src/CameraEntity.ts:257
Parameters
Section titled “Parameters”Vec2Buffer
worldX
Section titled “worldX”number
worldY
Section titled “worldY”number
Returns
Section titled “Returns”Vec2Buffer
zoomTo()
Section titled “zoomTo()”zoomTo(
target,duration,easing?):void
Defined in: renderer/src/CameraEntity.ts:237
Parameters
Section titled “Parameters”target
Section titled “target”number
duration
Section titled “duration”number
easing?
Section titled “easing?”EasingFunction
Returns
Section titled “Returns”void
Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/renderer.md.