Constant
scene
: SceneScopeThis object serves 2 purposes: * When called as a function, it defines a new scene with the name and the initializer function. * It can also be used to register scene-local event handlers that will be automatically cancelled when the scene is left.
param unknown- The scene name.
param unknown- The scene definition.
// define a scene
scene("game", () => {
// ...
});
// get options
scene("game", (opts) => {
debug.log(opts.level);
});
``````js
scene("pauseMenu", () => {
scene.onKeyPress("tab", () => {
debug.log("go to next menu item");
});
scene.onKeyPress("esc", () => {
// go back to game and cancel menu events
popScene();
});
});group Scenes