- This is my new MVP, you know, I struggle to create the most interesting supergame in the world.
-
The game process is shown at this picture, is it clear or no? Let me say a couple of words about… Hah, it’s the good ol’ find 'em all of these hidden bastards game! If you find an alien, press immediately a same color buttoon to find another one. Etc.
-
Okay, but it’s not that easy to play, ¿de acuerdo, my dear Solarians?
-
So, sometimes you will need to press the reset/reload scene button (it is a white square with a red round anti-clockwise arrow).
-
This is my code for this case.
Handle.Reset_Button = function (e) if (e.phase == "ended") then local currScene = composer.getSceneName ("current") composer.removeScene (currScene, true) composer.gotoScene ("level1234") end end Buttons.resetButton = widget.newButton ( { sheet = Sheets.ui, defaultFrame = 1, overFrame = 2, onEvent = Handle.Reset_Button } )
-
But, unfortunatelly, onEvent function works only one time, after the scene “level1234” is reloaded it doesn’t work and the game freezes!
-
Is it enough to set the composer.removeScene (currScene, true) or I have to include to the Handle.Reset_Button removing all objects and all eventListeners?
-
I tryed to follow Corona/Solar docs, I’ve found lots of topics about this issue (however, a lot of topics concerning Storyboard and Director, agrrr)… And my question, of course, is: HOW to reset a scene in a correct way nowdays. It could be perfect to see a step-by-step video of the really programmed and working example.
-
Better Call Rooooob!, season 14, episode 9