Reputation: 1805
I have to restart a scene created in cocos2d using a defined UIViewController. How can i do this? Please let me know how i can do this.
Upvotes: 0
Views: 531
Reputation: 10860
you can try to call something like
- (void) restart
{
[[CCDirector sharedDirector] replaceScene:[[self class] node]];
}
i think, it will work, but it is not good. IMHO, much better is to use smth like this
- (void) restart
{
// remove all your content
[self removeAllChildrenWithCleanup];
// reinitialize your instances
// re-add content again
[self addContent];
}
Upvotes: 3