Game Development Reference
prefer to transition scenes within a second or less, or avoid them altogether if it
fits the situation.
What you should certainly try to avoid is picking random transitions when re-
placing scenes. Players don't care, and game developers know you just got a
little over-excited by how cool the transitions are. If you don't know which
transition is right for a particular change of scene, don't use any at all. In other
words, just because you can doesn't mean you should.
Transitions add only one more line of code to replacing a scene, although admittedly
that one line can be a long one, given how long the names of transitions are and how
they get even longer with the number of parameters they often require. Here's the very
popular fade transition as an example; it fades to white in one second:
// initialize a transition scene with the scene we'd like to display next
CCTransitionFade* tran = [CCTransitionFade transitionWithDuration:1
// use the transition scene object instead of HelloWorld
[[CCDirector sharedDirector] replaceScene:tran];
You can use a CCTransitionScene with replaceScene and pushScene , but
as I said earlier, you can't use a transition with popScene (at least not at this
time—this may be improved in a future version of cocos2d).
A variety of transitions are available, although most are variations of directions—as in,
where the transition moves to or from which side it starts. Here's a list of the currently
available transitions, along with a short description for each:
▪ CCTransitionFade : Fades to a specific color and back. There's also
the CCTransitionCrossFade variation.
▪ CCTransitionFadeTR (three more variations): Tiles flip over to re-
veal a new scene.
▪ CCTransitionJumpZoom : Scene bounces and gets smaller; new scene
does the reverse.