Hello all,
I'm having a bit of a problem with replaceScene and I could not find something about it on the forums.
I have 2 scenes, one is the default HelloWorld scene, and another one I've created (AccessDenied scene).
In the HelloWorld scene I have this line of code to switch scenes:
(I've also imported the AccessDenied.h file to the HelloWorld.m file)
[[CCDirector sharedDirector] replaceScene:[CCZoomFlipXTransition transitionWithDuration:1 scene:[AccessDenied node]]];
The AccessDenied scene is empty with an NSLog in it:
(.h file)
#import "cocos2d.h"
@interface AccessDenied : CCLayer {
}
+(id) scene;
@end
(.m file)
#import "AccessDenied.h"
@implementation AccessDenied
+(id) scene
{
CCScene *scene = [CCScene node];
AccessDenied *layer = [AccessDenied node];
[scene addChild: layer];
return scene;
}
-(id) init {
if( (self=[super init] )) {
NSLog(@"ACCESS DENIED Scene");
}
return self;
}
@end
The scenes DO get replaced, and the NSLog is getting called, but afterwards the app crashes (without any message on the console, the last this there is the NSLog output).
Any idea why is this happenning?
Thanks!