Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Clearing stage on scene change using SceneManager.lua - Gideros Forum

Clearing stage on scene change using SceneManager.lua

Is there an option to set that will clear the stage upon scene change? Right now my main menu buttons stay on the screen when I change to level one. Do I have to clear them manually or is there an option to clear using 'changeScene'. I see there's an options parameter but I'm not sure what goes there.
Tagged:

Comments

  • In the options parameter of sceneManager you put parameters like easing, delay, custom parameters etc. Take a look to appcodingeasy website for the documentation.
    You should remove everything on stage by hand: it is easier if you put your buttons on a sprite, and then add this one to stage.

    Likes: antix

    +1 -1 (+1 / -0 ) Share on Facebook
  • piepie Member
    Accepted Answer
    Or you could add your buttons directly to the first scene, and let scenemanager take care of them :)
  • Apollo14Apollo14 Member
    edited December 2018
    function clear(scene)
    	for i = scene:getNumChildren(), 1, -1 do
    		scene:removeChildAt(i)
    	end
    	scene:removeAllListeners()
    end
    p. s. very helpful info on scenes:
    1) http://appcodingeasy.com/Gideros-Mobile/Manage-Scenes-in-Gideros-Mobile
    2)

    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “They did not know it was impossible so they did it” - Mark Twain
  • Thank you all. I didn't realize I could add children to the scene which would make them handled by the scene manager. Seems like I would have figured that out since the scene is just a sprite class. Thanks!
  • yes, if you use scenemanager then it is best if all sprites are children/grandchildren etc. of one of the scenes and then scene transitions work as expected.

    Likes: Apollo14

    +1 -1 (+1 / -0 ) Share on Facebook
Sign In or Register to comment.