Search code examples
iphoneipadcocos2d-iphonescenesprite-sheet

cocos2d transition between different scenes in iphone


I am intending to develop a story book using cocos2d. So i think i want to create scenes corresponding to the book pages. The book may consist of some 100 pages. So creating that much scene will be redundant. Is there any other ways in cocos2d for implementing the book pages and transition between pages


Solution

  • First of all,

    If you are thinking about specifying each page of the book as a separated in order to define a particular scene, you will get in trouble :)

    It would be much better to specify each scene in a .plist file. Define all the Book page content in a Key-Value fashion using several plists (one per page for example), and then just code a "Page Loader" Class which takes a *page_X.plist* file and return a Scene Object in your app.

    Something like:

    Scene *loaded = [SceneLoader sceneFromFile:@"page_1.plist"];

    For the transitions, each plist should contain information about how to transition your particular scene, you should take at CCTransitionTurnPage

    Good luck!