Can anyone please tell me how to reset a multiplexlayer scene.
I want the position, score , time to be reset to intial value.
can anyone please tell me how to do it
how to reset multiplexlayer scene?
(7 posts) (4 voices)-
Posted 2 years ago #
-
I'm in the same situation. When I press a button, I switch to the menu scene and want to start the game scene again But when I do this the game continues where it ends...? Maybe someone can help us.
Posted 1 year ago # -
*Push*
Posted 1 year ago # -
Maybe in your scene have only a minimal -init. Also create a -startScene which first removes anything in the scene, then it creates and places all the initial sprites the scene contains. Have -init call -startScene. Also call -startScene whenever you want to restart the scene.
Posted 1 year ago # -
Thanks man, but how can I remove anything in the scene?
Posted 1 year ago # -
-removeAllChildrenWithCleanup:cleanup to get rid of everything, or -removeChild:cleanup to remove an individual node.
Posted 1 year ago # -
@Codemattic: Thanks for the idea on the startScene method. I spent all day trying to reset the scene with CCDirector's replaceScene but couldn't replace the current scene with the same init method. Works perfect now.
Posted 1 year ago #
Reply
You must log in to post.