Okay, sweet. Thanks again for the help! [import]uid: 159810 topic_id: 24283 reply_id: 135383[/import]
Is there a way to properly goto a scene from an overlay scene?
For example:
menu.lua -> game.lua -> pausemenu.lua (this is an overlay on top of game.lua)
When I try to go back to menu.lua from pausemenu.lua using gotoScene(), the overlay instantly disappears…then the transition begins and menu.lua is loaded. How can I stop the overlay from disappearing when I call gotoScene()? [import]uid: 159810 topic_id: 24283 reply_id: 135372[/import]
I don’t think you can. Overlay’s sit on top of other scenes. To go to another scene implies that the overlay needs to disappear.
[import]uid: 199310 topic_id: 24283 reply_id: 135373[/import]
Ah, okay. I have settled with simply fading the overlay before calling gotoScene().
I suppose one could “fake it” however, by fading in a black rectangle over the whole scene (including the overlay) then calling gotoScene() from there.
In any case, thanks for the help! [import]uid: 159810 topic_id: 24283 reply_id: 135374[/import]
Actually, I’ve got another question.
Is there a way to entirely “nuke” a scene? In switching between scenes, I would like to completely nuke and unload the previous scene (all objects, listeners, timers, etc.) without having to manually do so in the scene’s “exitScene” event.
I have tried removeScene() with no luck (listeners are still active)
[import]uid: 159810 topic_id: 24283 reply_id: 135376[/import]
I’ve found it best to not use overlay when I have to go to other places. Overlays are great if you’re returning to your scene.
[import]uid: 199310 topic_id: 24283 reply_id: 135377[/import]
I just mean from “normal” scene-to-scene exchanges. Just looking for a way to “nuke” the previous scene so I don’t have to manually remove all of the listeners/timers and things from the exitScene listener. [import]uid: 159810 topic_id: 24283 reply_id: 135379[/import]
removeScene() dumps the whole scene (removes any display objects that it’s managing and calls the destroyScene() event handler.
You are still responsible for stopping timers, audio that’s playing that may have a call back, transitions that have onComplete handlers, etc. You probably should be making a habit of doing that in your exitScene() handler because if one of those call backs fires while your in another scene there is a good chance that you will crash with a segment violation crash.
[import]uid: 199310 topic_id: 24283 reply_id: 135382[/import]
Okay, sweet. Thanks again for the help! [import]uid: 159810 topic_id: 24283 reply_id: 135383[/import]