Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am learning a cocos2d based Game template tutorial from here and now I am at this point of the tutorial. My question is, how can i run 30 different scenes in 30 different levels of 5 chapter? Now I am using this

switch (gameData.selectedLevel) {

    case 1:

    [SceneManager goChapter1Level1Scene];


    (... snip a whole lot of lines...)

    case 30:

    [SceneManager goChapter5Level6Scene];


    default: break;


in the "- (void) onPlay: (CCMenuItemImage*) sender" method. But it work only for 6 levels scene of chapter1. Other 4 chapters levels are show as same as 1st chapter levels scene. they are not show their own level scene. can any one please teach me, how can I do this stuff using this game template?

share|improve this question
Just a code comment: If you have 30 different methods where the only difference is the numbers they take, and you're not doing goChapterLevel(5, 6) you either know exactly what you're doing or you're doing something horribly wrong. – doppelgreener May 20 '12 at 1:25
I would love to know the case for "know exactly what your doing". Seriously, I would. – nycynik May 20 '12 at 3:31
@nycynik On second thought there probably isn't one. – doppelgreener May 20 '12 at 4:35
That makes me feel better :) TY – nycynik May 20 '12 at 14:36
First four words of your question aren't actually needed, I suggest that you try to make your question titles less verbose and more concrete. Just my opinion... – jcora Jul 19 '12 at 14:04

It's a total guess here, but it seems like your calculation of selectedLevel might be wrong. How are you calculating it? Is it someting like Chapter*Level? I would check that your not just sending level, and so when the chapter changes it fails to change.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.