Hi
I'm using transitions a lot in my game, everything works fine. But when I try to interrupt/stop the transition with a touch it doesn't work. Is it possible to stop a transition with a touch event?
Here is my setup:
With the following I switch between Scenes as said before and it works great.
[[CCDirector sharedDirector] replaceScene: [TransitionScene transitionWithDuration:kTransitionTime scene: [StoryScene scene] withColor:ccBLACK]];
The TransitionScene class is a CCFadeTransition derived class.
It has a Layer (TransitionLayer) for receiving touch events to stop the Transition and switch to the main menu. TransitionScene overwrites initWithDuration in this way:
-(id) initWithDuration:(ccTime)d scene:(CCScene*)s withColor:(ccColor3B)aColor
{
if( (self=[super initWithDuration:d scene:s withColor:aColor]) ) {
// 'layer' is an autorelease object.
TransitionLayer *layer = [TransitionLayer node];
[layer setIsTouchEnabled:YES];
[layer setNextScreen:@"MenuScene"];
[layer setTargetedDelegate:NO];
// add layer as a child to scene
[self addChild: layer z:5];
}
return self;
}
Do I miss something or don't understand cocos2d architecture, when try to stop a transition and switch to another scene?
Thanks a lot
Martin