Having an issue with moving between scenes and having one removed properly. Basically I have a game.lua file which runs all of the levels, levelSelect.lua, pause.lua, and refresh.lua as my main scenes. refresh.lua contains the following:
local composer = require "composer"; local prev = composer.getSceneName "previous"; local scene = composer.newScene(); function scene:show(event) local phase = event.phase; if phase == "will" then composer.removeScene(prev); elseif phase == "did" then composer.gotoScene(prev, {params = event.params}); end end scene:addEventListener("show", scene); return scene
When I hide my pause.lua overlay (which also is run when the player dies and wins, kind of like the Angry Brids menu) I call composer.hideOverlay(true, “fade”, fadeTime); where fadeTime = 100 or 400 and when the pause menu will hide I call parent:resume(buttonName);. My problem is that when going to the next level through refresh.lua my game.lua scene is not actually ever being hidden. I go to the refresh.lua scene via composer.gotoScene(“scene.refresh”, {params = {worldNum = world, levelNum = level + 1}}); in scene:resume(buttonName) however the refresh.lua scene doesn’t actually hide the previous scene and when I go to the next level I also have the previous running behind it since none of the event listeners are removed via scene:hide(event) (since it isn’t ever called in game.lua).
Any ideas why?
Thanks