Hello,
Does anyone know what the script would be to change to a specific scene using JavaScript?
Many thanks.
Hello,
Does anyone know what the script would be to change to a specific scene using JavaScript?
Many thanks.
runtimeScene.requestChange(X,Y);
Adding some examples to the answer of Bouh
//Switching scenes
runtimeScene.requestChange(gdjs.RuntimeScene.REPLACE_SCENE, "sceneName");
//Pausing scene and starting another
runtimeScene.requestChange(gdjs.RuntimeScene.PUSH_SCENE, "sceneName");
//Restauring the paused scene
runtimeScene.requestChange(gdjs.RuntimeScene.POP_SCENE);
// Cancel any change request if it is not too late (do not do that, this is just an example but you really shouldn't do that)
runtimeScene.requestChange(gdjs.RuntimeScene.CONTINUE);
Thanks all
Seems like this does not work anymore for GDevelop 5?
runtimeScene.requestChange(gdjs.RuntimeScene.REPLACE_SCENE, jump)
runtimeScene.requestChange(gdjs.RuntimeScene.CLEAR_SCENES, jump);
None of them work.
Indeed, the enum has been separated from RuntimeScene, it has now its own object:
// gdjs.RuntimeScene => gdjs.SceneChangeRequest
runtimeScene.requestChange(gdjs.SceneChangeRequest.PUSH_SCENE, "New scene");
Ok thanks mate. Its working now.