To maintain the state of a scrolling level menu
Iam working on a game in which I have created a horizontal scrolling menu for levels using CCScrollLayer. On that menu I have added a back button which when pressed takes the user to main menu. What I want is: I want to maintain the state of the level menu when user comes back to the level selection screen. Heres what Iam doing:
CCScrollLayer * scrolllayer = [[CCScrollLayer alloc] initWithLayers:[NSMutableArray arrayWithObjects:layer1,layer2,layer3, nil] widthOffset:230]; //scrolllayer.showPagesIndicator = YES; [self addChild:scrolllayer z:0];
I have created a scrollLayer and added a back button on it. Suppose user is playing level No.3 and presses the back button to go to main menu. After that if user goes back to level selection screen then the level 3 should come on the screen. The menu should not show the levels from the beginning.
Thanks for your time.
Maintain the level number any where... And use this method
The scroller will move to that level...
Hope this helps.. :)