Types
SceneDef
interface SceneDef
From @phaser-ae/kernel
A scene: a name and what happens on the way in and out. Scenes are a kernel service because ownership hangs off
them: every object, timer, game.step, game.frame and own disposer belongs to the scene that was current when
it was made, and goes when that scene exits.
readonly name: string— Unique: registering the name again replaces the scene.enter?(): void— Runs after thescene.enterhook, with this scene current: what it spawns, schedules and steps is this scene's.exit?(): void— Runs first when the scene leaves, before thescene.exithook, while the scene's objects still exist.
Scenes
interface Scenes
From @phaser-ae/kernel
The scene stack, bottom to top. Every name must be registered before go or push; unknown names throw.
register(def: SceneDef): void— Define a scene. Registering a name again replaces it (the last definition wins), so a scene registered inside another'sentercan run again; a scene on the stack exits and enters by its new definition from then on.has(name: string): boolean— Is a scene registered under this name? For a pack that wants to supply a default only when the game has not.go(name: string): void— Exit the entire stack, top first, and enter the destination: everything the exited scenes made goes with them. Going to the current scene restarts it. Use push/pop for overlays.push(name: string, opts?: { transparent?: boolean; suspend?: boolean }): void— Push a scene over the current one. By default the scenes beneath are SUSPENDED: their objects stay on stage and keep rendering, frozen — out of every query, their anims and timers andgame.steps held — untilpop(). This is the game-level pause (a pause menu, a shop, a dialogue).suspend: falseruns them in parallel (a HUD).transparent: falsealso hides the scenes beneath. A scene already on the stack cannot be pushed again: it throws.isSuspended(name: string): boolean— Is this scene currently suspended beneath another?pop(): void— Leave the top scene and resume what it suspended. The scene beneath is current again: objects, timers and steps made afterpopbelong to it. No-op when only one scene is on the stack.readonly current: string— The top of the stack; '' before the firstgo.readonly stack: ReadonlyArray<string>— Bottom to top.
