storyboard's exitScene event not working properly

Hi there,

I’m experiencing an issue recently found on an old but working code. I’ve a gameplay scene, and there’s a pause button which calls an overlay scene. From pause scene you can resume the gameplay or get back to the menu. It worked correctly until today – it looks like using a gotoScene from the overlay scene doesn’t call the gameplay’s exitScene

Any idea?

There hasn’t been changes to Storyboard in quite a while.  You might need to post some code…  What is your exitScene doing?  Is it possible those activities were done as part of your pausing previously?  Did exitScene get called when the overlay was called?

How do you know it’s not firing?  Are you doing prints?  Do prints after it come out?

Rob

Everything worked properly last time I tested while ago. The problem is with the overlay, because when resuming the game the overlay stays there even calling the hideOverlay function…

This is the function where the pause overlay is called:

function scene:pause(event) ... if event.isPause then local options = { effect = "fade", time = 400, isModal = true, params = { currentStage = scene.stage, currentLevel = scene.level } } storyboard.showOverlay("pause", options) end ... end

And this is a simplification of the pause scene:

local storyboard = require "storyboard" local scene = storyboard.newScene() ... function scene.onTouch(event) if event.phase == "release" then if event.id == "Resume" then local fadeTime = 400 storyboard.hideOverlay("fade", fadeTime) elseif event.id == "Menu" then local options = { effect = SCENE\_TRANSITION\_EFFECT, time = SCENE\_TRANSITION\_TIME, params = { stage = mCurrentStage, level = mCurrentLevel, resume = false } } storyboard.gotoScene("menu.menu", options) ... end end end function scene:createScene( event ) ... end scene:addEventListener("createScene", scene) return scene

The thing is I’ve the same code in another old project and works like a charm

I downloaded the storyboard module released when the composer was introduced and I’m using this to debug and trying to figure out what’s going on. When creating the overlay seems it’s ok, but when hiding it looks like the “currentOverlay” is nil and nowhere is accessing and modifying it

Uhm… Ok, I already solved it using a workaround: I used to require the storyboard in every single scene – instead of this, I required it once at the beginning of the app and stored it in a global variable

There hasn’t been changes to Storyboard in quite a while.  You might need to post some code…  What is your exitScene doing?  Is it possible those activities were done as part of your pausing previously?  Did exitScene get called when the overlay was called?

How do you know it’s not firing?  Are you doing prints?  Do prints after it come out?

Rob

Everything worked properly last time I tested while ago. The problem is with the overlay, because when resuming the game the overlay stays there even calling the hideOverlay function…

This is the function where the pause overlay is called:

function scene:pause(event) ... if event.isPause then local options = { effect = "fade", time = 400, isModal = true, params = { currentStage = scene.stage, currentLevel = scene.level } } storyboard.showOverlay("pause", options) end ... end

And this is a simplification of the pause scene:

local storyboard = require "storyboard" local scene = storyboard.newScene() ... function scene.onTouch(event) if event.phase == "release" then if event.id == "Resume" then local fadeTime = 400 storyboard.hideOverlay("fade", fadeTime) elseif event.id == "Menu" then local options = { effect = SCENE\_TRANSITION\_EFFECT, time = SCENE\_TRANSITION\_TIME, params = { stage = mCurrentStage, level = mCurrentLevel, resume = false } } storyboard.gotoScene("menu.menu", options) ... end end end function scene:createScene( event ) ... end scene:addEventListener("createScene", scene) return scene

The thing is I’ve the same code in another old project and works like a charm

I downloaded the storyboard module released when the composer was introduced and I’m using this to debug and trying to figure out what’s going on. When creating the overlay seems it’s ok, but when hiding it looks like the “currentOverlay” is nil and nowhere is accessing and modifying it

Uhm… Ok, I already solved it using a workaround: I used to require the storyboard in every single scene – instead of this, I required it once at the beginning of the app and stored it in a global variable