Open IlyaSemenov opened 2 years ago
Hi! I've seen an example of calling nested scene
ctx.scene.call("add_item");
How nested scenes are actually implemented here, or how to bring the nested scene into a global one?
Would be grateful for clarification!
@ruxxzebre nesting may mean two things:
1) nested declarations 2) nested invocations
This issue mentions the need of nested declarations. Nested invocations (of globally declared scenes) are already working. You may think of that as nested calls of global functions (calling one global function in middle of another global function).
In the example that you refer to, the code implies that add_item
is an another (global) scene:
const addItemScene = new Scene("add_item")
addItemScene.do().... // configure it
sceneManager.scene(addItemScene) // register it in the global scene manager
// ...
// from another scene:
ctx.scene.call("add_item")
Hope that makes sense now.
Modularizing parts of logic either leads to one-off global scenes, or excessive use of labels/goto. I'd want to setup nested scenes locally within the context of an outer scene.
Something like: