Reputation: 1
Using cocos2d in my game, i need to reload all scene when level complete.
My game is in one class helloWorldLayer.mm
, and it has conditions to load different backgrounds for different levels.
What i want is that when level complete,i increment the level by 1 , and load the whole scene again( the init) , so the new backgrounds and sprites will reloaded.
What is the best way to do that ??
thanks a lot .
Upvotes: 0
Views: 186
Reputation: 6114
i suppose u are loading the data from plist .
what u have to do is remove all the items from the scene and then call your loadingplist function and recreate the layer.
You can have a singleton to store your level count , once the game is completed increment the value in the singleton then retrive the value later to recreate the next level.
Hope this helps ..
Upvotes: 1