Hi All,
I am trying to the restart the same level of the game once it is completed. I am using alert view to display at the time of Finish. I'm using 2 buttons in AlertView (End and PlayAgain). Once end is touched it should end that is working fine. The problem is once playAgain is touched The AlertView is displayed once again but i need to restart the game. The code for button index of AlertView is as shown below.
-(void)alertView :(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex==0){
exit(0);
NSLog(@"exit");
}
else if(buttonIndex==1){
// [self retain];
GameScene *gameScene = [GameScene node];
[[Director sharedDirector] replaceScene:gameScene];
NSLog(@"Play Again");
}
}
Here I am trying to load my gamescene once again. Is it the right way to do.
Please help me on this.
Thanks in Advance,