I have a scene created like that:
MyScene (subclass of CClayer)
.m
+(CCScene *) sceneWithSprite:(CCSprite*)sback
{
return [[[self alloc] initWithSprite:sback] autorelease];
}
-(id) initWithSprite:(CCSprite*)sback
{
self = [super init];
if (self) {
self.spriteBack = sback;
// sback is a sprite that comes from the previous scene
// remove sback from that scene, so we can add it here
[sback removeFromParentAndCleanup:NO];
[self addChild:self.spriteBack z:-1];
CGSize windowSize = [[CCDirector sharedDirector] winSize];
CGFloat midX = windowSize.width/2.0f;
CGFloat midY = windowSize.height/2.0f;
CCMenuItemLabel *menuItem1 = [CCMenuItemFont itemFromString:@"item 1" target:self selector:@selector(multi:)];
CCMenuItemLabel *menuItem2 = [CCMenuItemFont itemFromString:@"item 2" target:self selector:@selector(multi:)];
CCMenuItemLabel *menuItem3 = [CCMenuItemFont itemFromString:@"item 3" target:self selector:@selector(multi:)];
CCMenu *menu = [CCMenu menuWithItems:menuItem1, menuItem2, menuItem3, nil];
[menu alignItemsVertically];
[self addChild:menu];
menu.position = ccp(midX, midY);
}
return self;
}
I need to do a fade down transition. I call the new scene, from the previous one, using
CCScene *menu = [Menu sceneWithSprite:spriteBack];
[[CCDirector sharedDirector] replaceScene:
[CCTransitionFadeDown transitionWithDuration:0.5f scene:menu]];
The problem is that the transition happens to black then the new scene appears suddenly.
Is there a way to make the transition from the current scene to the new one without this black?
thanks
Try
CCTransitionCrossFade. If you have problems with that one fading to white in the middle of the crossfade, see this thread: http://www.cocos2d-iphone.org/forum/topic/28949