I encountered an error when I try to play my game level again. I am using an empty scene, so I can smoothly call the same scene again. This is working like this:
I have my game level in level.lua. Whenever I am going to another scene I call an empty scene loadnextscene.lua which then can remove the old scenes and change to the new scene. This way I normally have no issues when calling level.lua from inside level.lua.
BUT: Now I’m encountering an issue where the game stops completely without an error message. Some print statements are showing the game exits, when the code has reached the end of the scene:show( event ) phase “will” part, just before entering the “did” phase.
I’m checking like this:
Composer code in level.lua:
... showPopup("createText",sceneGroup,1,1,theStory,Storyindex,2) -- preparing some text info print ("Entering the DID now...") elseif ( phase == "did" ) then -- Called when the scene is now on screen. -- Insert code here to make the scene come alive. -- Example: start timers, begin animation, play audio, etc. print ("inside the did phase!") composer.removeScene( "appstore.appleappstore" ) composer.removeScene( "mainmenu" ) composer.removeScene( "levelselection" ) composer.removeScene( "loadnextscene" ) -- this is the empty scene where level.lua is removed composer.removeScene( "levelselection\_system") composer.removeHidden() ...
the print (“inside the did phase!”) is not getting called!
The last thing I can see with logcat is the print statement “Entering the DID now…”
What can cause the complete EXIT at this exact point in the code?
The problem is this is not happening all the time but only sometimes. When it happens, then it happens again when tried again. But sometimes the level.lua can call level.lua without any problems.
Any help welcome!