I have an intermediate scene for when it’s “Game Ove” I can reload the first scene again:
gameScene:
gameOver = function ( ) -- gets called in a collision event -- Code to remove eventListeners and do some cleaning. composer.gotoScene( "gameOverScene" , {time=2000, effect="flip"} ) end
gameOveScene:
function scene:create( event ) local sceneGroup = self.view composer.removeScene( "gameScene") composer.gotoScene( "gameScene" , {time=1000, effect="flip"} ) end
The problem is that the scene does restart but the behaviour is all messed up. I do reset the values for stuff like (score) but the game doesn’t run as expected the second time, and the event for"gamOver" doesn’t execute the second time. Also, the transition effect doesn’t occur.