Skip to content

LoadingSceneProgressBar

Defined in: ui/src/LoadingSceneProgressBar.ts:61

Ready-made loading progress bar for use inside a LoadingScene.

Spawn it from the scene’s onEnter, then call this.startLoading() to kick off the load:

class Boot extends LoadingScene {
readonly target = new GameScene();
override onEnter() {
this.spawn(LoadingSceneProgressBar);
this.startLoading();
}
}

Subscribes to scene:loading:progress internally and updates a UIProgressBar. For spinners, animated text, or other custom visuals, write your own component that subscribes to the same event.

  • Entity

new LoadingSceneProgressBar(name?, tags?): LoadingSceneProgressBar

Defined in: core/dist/index.d.ts:351

string

Iterable<string, any, any>

LoadingSceneProgressBar

Entity.constructor

readonly id: number

Defined in: core/dist/index.d.ts:339

Unique auto-incrementing ID.

Entity.id


readonly name: string

Defined in: core/dist/index.d.ts:341

Display name for debugging.

Entity.name


readonly tags: Set<string>

Defined in: core/dist/index.d.ts:343

Tags for group queries.

Entity.tags


static [TRAITS_KEY]: Set<symbol>

Defined in: core/dist/index.d.ts:337

Entity.[TRAITS_KEY]

get children(): ReadonlyMap<string, Entity>

Defined in: core/dist/index.d.ts:371

Named children as a read-only map. Empty map if no children.

ReadonlyMap<string, Entity>

Entity.children


get isDestroyed(): boolean

Defined in: core/dist/index.d.ts:367

True if destroy() has been called.

boolean

Entity.isDestroyed


get parent(): Entity | null

Defined in: core/dist/index.d.ts:369

The parent entity, or null if this is a root entity.

Entity | null

Entity.parent


get scene(): Scene

Defined in: core/dist/index.d.ts:363

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 destroy() tears it down. Inside lifecycle methods (setup, component onAdd, update, etc.) 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.

Scene

Entity.scene


get tryScene(): Scene | null

Defined in: core/dist/index.d.ts:365

The scene this entity belongs to, or null if detached.

Scene | null

Entity.tryScene

_performDestroy(): void

Defined in: core/dist/index.d.ts:426

Internal

Internal: perform actual destruction — remove all components and clear state. Called by Scene during endOfFrame flush.

void

Entity._performDestroy


_setScene(scene, callbacks): void

Defined in: core/dist/index.d.ts:443

Internal

Internal: set the scene and callbacks. Called by Scene.spawn().

Scene | null

EntityCallbacks | null

void

Entity._setScene


add<C>(component): C

Defined in: core/dist/index.d.ts:403

Add a component instance. Returns the component for chaining.

C extends Component

C

C

Entity.add


addChild(name, child): void

Defined in: core/dist/index.d.ts:373

Add a named child entity. Auto-adds to parent’s scene if not already in one.

string

Entity

void

Entity.addChild


optional afterRestore(data, resolve): void

Defined in: core/dist/index.d.ts:436

Called after components are restored during save/load. Rebuild non-serializable state here.

unknown

SnapshotResolver

void

Entity.afterRestore


destroy(): void

Defined in: core/dist/index.d.ts:420

Mark for deferred destruction. Actual cleanup happens at end of frame.

void

Entity.destroy


emit(token): void

Defined in: core/dist/index.d.ts:415

Emit a typed event on this entity. Bubbles to the scene.

EventToken<void>

void

Entity.emit

emit<T>(token, data): void

Defined in: core/dist/index.d.ts:416

Emit a typed event on this entity. Bubbles to the scene.

T

EventToken<T>

T

void

Entity.emit


get<C>(cls): C

Defined in: core/dist/index.d.ts:405

Get a component by class. Throws if not found.

C extends Component

ComponentClass<C>

C

Entity.get


getAll(): Iterable<Component>

Defined in: core/dist/index.d.ts:418

Get all components as an iterable.

Iterable<Component>

Entity.getAll


getChild(name): Entity

Defined in: core/dist/index.d.ts:399

Get a child by name. Throws if not found.

string

Entity

Entity.getChild


has(cls): boolean

Defined in: core/dist/index.d.ts:409

Check if entity has a component of the given class.

ComponentClass

boolean

Entity.has


hasTrait<T>(token): this is LoadingSceneProgressBar & T

Defined in: core/dist/index.d.ts:438

Check if this entity’s class implements a given trait. Acts as a type guard.

T

TraitToken<T>

this is LoadingSceneProgressBar & T

Entity.hasTrait


on<T>(token, handler): () => void

Defined in: core/dist/index.d.ts:413

Subscribe to a typed event on this entity. Returns an unsubscribe function.

T

EventToken<T>

(data) => void

() => void

Entity.on


remove(cls): void

Defined in: core/dist/index.d.ts:411

Remove a component by class.

ComponentClass

void

Entity.remove


removeChild(name): Entity

Defined in: core/dist/index.d.ts:397

Remove a named child. Returns the detached entity.

string

Entity

Entity.removeChild


optional serialize(): unknown

Defined in: core/dist/index.d.ts:434

Return a JSON-serializable snapshot of this entity’s custom state. Used by the save system.

unknown

Entity.serialize


setup(opts?): void

Defined in: ui/src/LoadingSceneProgressBar.ts:62

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.

LoadingSceneProgressBarOptions = {}

void

Entity.setup


spawnChild(name): Entity

Defined in: core/dist/index.d.ts:389

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.

this.spawnChild("body", EnemyBody, { color: 0xff6b6b });
this.spawnChild("hp", EnemyHealthBar);

string

Entity

Entity.spawnChild

spawnChild<E>(name, Class): E

Defined in: core/dist/index.d.ts:390

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.

this.spawnChild("body", EnemyBody, { color: 0xff6b6b });
this.spawnChild("hp", EnemyHealthBar);

E extends Entity

string

() => E

E

Entity.spawnChild

spawnChild<E, P>(name, Class, params): E

Defined in: core/dist/index.d.ts:391

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.

this.spawnChild("body", EnemyBody, { color: 0xff6b6b });
this.spawnChild("hp", EnemyHealthBar);

E extends Entity

P

string

() => E & object

P

E

Entity.spawnChild

spawnChild<P>(name, blueprint, params): Entity

Defined in: core/dist/index.d.ts:394

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.

this.spawnChild("body", EnemyBody, { color: 0xff6b6b });
this.spawnChild("hp", EnemyHealthBar);

P

string

Blueprint<P>

P

Entity

Entity.spawnChild

spawnChild(name, blueprint): Entity

Defined in: core/dist/index.d.ts:395

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.

this.spawnChild("body", EnemyBody, { color: 0xff6b6b });
this.spawnChild("hp", EnemyHealthBar);

string

Blueprint<void>

Entity

Entity.spawnChild


tryGet<C>(cls): C | undefined

Defined in: core/dist/index.d.ts:407

Get a component by class, or undefined if not found.

C extends Component

ComponentClass<C>

C | undefined

Entity.tryGet


tryGetChild(name): Entity | undefined

Defined in: core/dist/index.d.ts:401

Get a child by name, or undefined if not found.

string

Entity | undefined

Entity.tryGetChild