I've been using:
[[CCDirector sharedDirector] replaceScene:[CCFadeTransition transitionWithDuration:1.0 scene:[MenuScene node]]];
and it works perfectly fine. However when I have been inside the game scene and want to go back to the menu I implement this code to be activated from a UIAlertView:
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
// the user clicked one of the OK/Cancel buttons
if (buttonIndex == 0)
{
NSLog(@"Go To Menu");
enemyblob.position = ccp(240, 650);
blob.position = ccp(240, 350);
blob.score=0;
enemyblob.score=0;
isPlaying = 0;
[[CCDirector sharedDirector] replaceScene:[CCFadeTransition transitionWithDuration:1.0 scene:[MenuScene node]]];
}
}
This works fine, however about 2 seconds later, the app crashes and displays no errors in the console. Any ideas?