Types
Advanced
interface Advanced
From @phaser-ae/kernel
What game.advance reports when it has run.
frames: number— Frames run and drawn.steps: number— Fixed steps run.time: number— Simulation time after it, seconds.waited: number— Real seconds spent waiting for files to load, while game time stood still.scene: string— The top scene after it.
AdvanceOptions
interface AdvanceOptions
From @phaser-ae/kernel
Options for game.advance.
fps?: number— Frames to draw per second of game time. Default 10: six fixed steps a frame at 60 Hz. More shows motion between steps; fewer runs faster. The fixed step never changes, so the game plays the same either way.loads?: 'wait' | 'run'— While files load,'wait'(the default) stands game time still until they land, as if the network were instant;'run'plays on through the load, as a slow network would.
InspectedAsset
interface InspectedAsset
From @phaser-ae/kernel
An asset by key, from inspect('<key>').
key: string— The key.kind: string—imagefor a picture or sprite strip in the atlas; else the loader's kind (audio,json,font…).frames?: { first: number; count: number; width: number; height: number }— For a picture: its frames and the size of one, in texture pixels.users: string[]— Live objects showing it.failed?: string— Why it failed to load, when it did.
InspectedObject
interface InspectedObject
From @phaser-ae/kernel
One object, as inspect reports it. Positions are its centre, sizes as drawn (scale applied).
id: string— Its id,frog-3.owner: string— The pack that spawned it, orgame.tags: string[]— Its tags.scene: string— The scene that owns it ('' before any scene).layer: string— Its layer.x: number— Centre x.y: number— Centre y.z?: number— z, in a 3D world (left out when 0).width: number— Width as drawn:width × |sx|.height: number— Height as drawn:height × |sy|.rot: number— Rotation, radians.sx: number— Scale; a negative one mirrors.sy: number— Scale y.shown: boolean— Drawn this frame: visible, not hidden by an opaque scene above, and not fully transparent.visible: boolean— Itsvisibleflag.alpha: number— Opacity.tint: string— Tint, as hex.image: string— The picture: the strip key, with[n]for a frame past the first:frog-hop[2].whiteis the plain square.anim?: { name: string; done: boolean }— The animation playing, if any.frozen?: boolean— True while its scene is suspended beneath another.data?: Record<string, unknown>— Itsdata, as plain values.[pack: string]: unknown— What packs know about it, by pack name:text: { text, size },ui: { kind, text, disabled }.
InspectFn
interface InspectFn
From @phaser-ae/kernel
game.inspect: the inspection, and the call that registers the game's own state for it.
(target?: string | { x: number; y: number }): Inspection— Inspect the whole game, or only whattargetnames: an id or id prefix, a tag, a layer, an asset key, a pack, or a point in world units.state(read: (() => unknown) | null): void— Register what the game knows about the run, read fresh at every inspection:game.inspect.state(() => run), with the run's state in one object (level, lives, score, power-ups, difficulty). A host, a reviewer's change request and an agent checking a build then read "level 14, 1 life, score 8400" from the game itself rather than from its labels. One reader at a time: a second call replaces the first, and null removes it. A reader that throws reports the error as the state.
Inspection
interface Inspection
From @phaser-ae/kernel
game.inspect(): the game at this moment as plain data, for a tool to read and an agent to reason about —
every object with its picture, place, size and state, the scenes, the clock, the input and the loads, plus
whatever each composed pack knows (the text a label shows, a button's state, the music playing).
Everything in it is a copy; changing it changes nothing in the game.
match: 'scene' | 'object' | 'tag' | 'layer' | 'asset' | 'pack' | 'point' | 'none'— What the target matched:scenewith no target, elseobject,tag,layer,asset,pack,pointornone.target: string | null— The target as given.clock: { time: number; frame: number; step: number; timeScale: number; paused: boolean; held: boolean }— Simulation time, steps run, and whether the clock is paused or held.screen: { width: number; height: number }— The logical screen size, in pixels.scenes: { current: string; stack: string[]; suspended: string[] }— The scene stack, bottom to top, and the scenes suspended beneath another.camera: { x: number; y: number; zoom: number; rot: number; z?: number; yaw?: number; pitch?: number; distance?: number }— The camera's position and zoom: a 2D world object at the camera's x, y is drawn at the centre of the screen. A 3D world's camera also has its z, yaw, pitch and distance (when any is set).input: { keys: string[]; pointers: { x: number; y: number; down: boolean }[]; ignoring: number }— What input the game has now: keys held, pointers down, and seconds of input still ignored after a scene change.assets: { loading: boolean; progress: number; failed: { key: string; error: string }[] }— Loading: true while a fetch is in flight, how far it has got (0..1, 1 when idle), and the files that failed for good, with why.ready: boolean— Whether the game can be played yet (game.isReady): false while it loads, and a host shows "loading".state?: unknown— The game's own state, asinspect.stateregistered it (the level, lives, score), in plain values. Left out when none is registered.objects: InspectedObject[]— The objects matched (every live one for the scene), back to front as drawn.asset?: InspectedAsset— The asset the target named: its kind, frames, size, and which live objects show it.packs: Record<string, unknown>— What each composed pack reports about itself, by its name:sound,ui,text… Only the named pack for a pack target.
InspectorDef
interface InspectorDef
From @phaser-ae/kernel
A pack's part of an inspection, registered under the registry kind 'inspect': the pack's own state, and
what it knows about the objects it made. The kernel never imports a pack; this is how it learns the text a
paragraph shows or the label on a button.
name: string— The name it reports under, inpacksand on objects:sound,ui,text.describe?(): unknown— The pack's own state, as plain values: the music playing, the sounds played lately.object?(h: Handle): Record<string, unknown> | undefined— What it knows about one object, as plain values; undefined for an object that is not its own.
