Back to Phaser

Scenes — Reference

skills/scenes/references/REFERENCE.md

4.1.04.1 KB
Original Source

Scenes — Reference

API reference tables and source file maps for the scenes skill.

API Quick Reference

ScenePlugin Methods (this.scene)

All methods are queued and execute on the next Scene Manager update, not immediately.

MethodSignatureDescription
start(key?, data?) => thisStop this scene, start target. No key = restart self.
restart(data?) => thisStop and restart this scene
launch(key, data?) => thisStart another scene in parallel
run(key, data?) => thisStart/resume/wake another scene (smart)
pause(key?, data?) => thisPause scene (no key = this scene)
resume(key?, data?) => thisResume paused scene
sleep(key?, data?) => thisSleep scene (no update, no render)
wake(key?, data?) => thisWake sleeping scene
switch(key, data?) => thisSleep this scene, start/wake target
stop(key?, data?) => thisShutdown scene (no key = this scene)
transition(config) => booleanAnimated transition to target scene
get(key) => SceneGet a scene reference by key
getStatus(key) => numberGet scene status constant
getIndex(key?) => numberGet scene position in scenes array
add(key, sceneConfig, autoStart?, data?) => Scene?Add new scene to manager
remove(key?) => thisRemove and destroy scene
setActive(value, key?, data?) => thisSet active state (true=resume, false=pause)
setVisible(value, key?) => thisSet visible state
isActive(key?) => booleanCheck if scene is running
isPaused(key?) => booleanCheck if scene is paused
isSleeping(key?) => booleanCheck if scene is sleeping
isVisible(key?) => booleanCheck if scene is visible
bringToTop(key?) => thisRender above all others
sendToBack(key?) => thisRender below all others
moveUp(key?) => thisMove one position up in render order
moveDown(key?) => thisMove one position down in render order
moveAbove(keyA, keyB?) => thisMove keyB above keyA
moveBelow(keyA, keyB?) => thisMove keyB below keyA
swapPosition(keyA, keyB?) => thisSwap positions of two scenes

Systems Methods (this.sys)

MethodReturnsDescription
getData()anyGet data passed to this scene
getStatus()numberCurrent status constant
isActive()booleanIs RUNNING?
isPaused()booleanIs PAUSED?
isSleeping()booleanIs SLEEPING?
isVisible()booleanIs visible?
isTransitioning()booleanIs transitioning in or out?
isTransitionOut()booleanIs transitioning out?
isTransitionIn()booleanIs transitioning in?
canInput()booleanCan receive input? (status between PENDING and RUNNING)
setActive(value, data?)SystemsResume (true) or pause (false)
setVisible(value)SystemsSet render visibility
pause(data?)SystemsPause this scene
resume(data?)SystemsResume this scene
sleep(data?)SystemsPut to sleep
wake(data?)SystemsWake from sleep

Source File Map

FilePurpose
src/scene/Scene.jsBase Scene class with all injected property declarations
src/scene/Systems.jsScene systems: lifecycle management, pause/resume/sleep/wake
src/scene/SceneManager.jsGame-level manager: boots scenes, runs lifecycle, processes queue
src/scene/ScenePlugin.jsthis.scene plugin: user-facing API for scene operations
src/scene/Settings.jsCreates scene settings object from config
src/scene/const.jsScene state constants (PENDING=0 through DESTROYED=9)
src/scene/InjectionMap.jsMaps Systems properties to Scene properties
src/scene/events/index.jsEvent name exports
src/scene/events/*_EVENT.jsIndividual event definitions with JSDoc signatures
src/scene/GetPhysicsPlugins.jsResolves physics plugins for a scene
src/scene/GetScenePlugins.jsResolves scene plugins