Function

popScene

(): void

Pops the scene from the stack and set as current active scene. Only works if the current scene was entered using pushScene.

scene("mainScene", () => {
    add([
        text("this is the first scene", { size: 32 }),
        pos(center()),
    ]);
});
scene("otherScene", () => {
    add([
        sprite("bean"),
        pos(center()),
    ]);
});

pushScene("mainScene");
popScene(); // return to the current scene

since v3001.1

group Scenes

kaplay logo

Components

Miscalenous