Change level

I’m having some problems trying get level changes to work.

I have a listener checking for when the player’s score reaches 5.
At which point, I want to load a new level.

But it still displays the current level, and the player is no longer controllable.

Also, how do you preview/play-test different level files (level1.lua, level2.lua) if the simulator will only run “main.lua”?

-- Beat Level1  
local function beatLevel1()  
if score == 5 then  
storyboard.gotoScene( "scene2", "fade", 400 )  
end  
  
end  
   
Runtime:addEventListener("enterFrame", beatLevel1)  

Much Thanks! [import]uid: 27117 topic_id: 18762 reply_id: 318762[/import]

Sort of figuring it out.

If I add

foreground:removeSelf()  
background:removeSelf()  

It works.
All objects in the fore and background get deleted.
If I add

storyboard:removeScene( "scene1", "fade", 400)  

…it doesn’t seem to work. The scene is layered over scene2.
[import]uid: 27117 topic_id: 18762 reply_id: 72219[/import]