How do we fade an entire scene? searched forum without success
Any help much appreciated.
A fast, easy to use, free, and community supported 2D game engine
How do we fade an entire scene? searched forum without success
Any help much appreciated.
You can fade an entire scene using a transition:
http://www.cocos2d-iphone.org/api-ref/0.8.1/interface_fade_transition.html
Which basically takes you from one scene to another and performs a fade effect while doing so.
i have wrong reply :|
we just want to fade the current scene from black up to proper colours and not from scene to scene
Hey dude, Why not make a sprite that IS black, and use that as a global fading object? You could turn off smoothing, and probably get by with even a 1x1 px size image.
I haven't tried it, but it might be something like this:
// Grab our sprite
blackCanvas = [self._interfaceAtlas getChildByTag:1];
// This works because it's 1 pixel in size
[blackCanvas setScaleX: newWidth];
[blackCanvas setScaleY: newHeight];
[blackCanvas stopAllActions]; // Always do this
fadeIn = [FadeIn actionWithDuration:0.4];
// How do we introduce a pause, i'm not sure maybe a move to or some sort
// of action thats arbitary or super miniscule it can't be noticed
// Maybe there's a better way, but this is quick and dirty for now.
fadeInHold = [FadeIn actionWithDuration:];
fadeOut = [FadeOut actionWithDuration:0.1];
// Create a sequence using the actions
// Always pass nil after the last one you're done - this could be
// old hat to you but to me its worth noting
sequence = [Sequence actions: fadeIn,fadeInHold, fadeOut, nil];
// Now set it and forget it.
[blackCanvas runAction: sequence];You must log in to post.