2012年6月13日 星期三

Cocos2d 2.0 Scene Transition

Scene

A scene in Cocos2d is just a special sort of node that acts as the ultimate parent for all other nodes that are visible.

To run with a scene:

[[CCDirector sharedDirector] runWithScene: [MyScene scene]];

To replace a scene:

[[CCDirector sharedDirector] replaceScene: [MyScene scene]];

Cocos2d 2.0 Scene Transition

Fancy transition between scenes is supported with CCTransition*.

Sample code for Scene Transition:

[[CCDirector sharedDirector] replaceScene:
      [CCTransitionFade transitionWithDuration:1.0f scene:[MyScene scene]]];

You may replace CCTransitionFade with:

  • CCTransitionFlipAngular
  • CCTransitionShrinkGrow
  • CCTransitionMoveInB
  • CCTransitionMoveInT
  • CCTransitionMoveInL
  • CCTransitionMoveInR
  • CCTransitionFadeTR
  • CCTransitionFadeUp
  • CCTransitionFlipX
  • CCTransitionFlipY
  • CCTransitionPageTurn
  • CCTransitionCrossFade

沒有留言:

張貼留言