I have a problem with properly handling “suspend” events when using Storyboard. When the application has been suspended, I want to tell Storyboard to go to my pause screen. But it seems that storyboard.gotoScene during the applicationSuspend event is ignored.
So, I’m doing gotoScene in the applicationResume event, and that works. The problem with this though, is that Storyboard first activates my previous scene for half a second when the app resumes, then goes to my pause screen. This looks really bad, because my previous screen usually plays sounds and starts animations, so it looks buggy. The previous screen should not show up at all when the user is resuming the game.
Here’s what I’m doing:
local function onSystemEvent(event) if (event.type == "applicationExit") then game.save() stage.stopAll() elseif event.type == "applicationSuspend" then game.save() storyboard.purgeAll() storyboard.gotoScene("pause") elseif event.type == "applicationResume" then storyboard.purgeAll() storyboard.gotoScene("pause") end end
Is there any way I can manually tell Storyboard what scene should be resumed? Or maybe have it purge the active scene in the Suspend event? There must be a way to do this.
Any ideas?
Thanks,
George