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.

Regards

Shailesh

Answers


Maintain the level number any where... And use this method

-(void) moveToPage:(int)page;

The scroller will move to that level...

Hope this helps.. :)


Need Your Help

Grails doesn't add headers for json

json grails curl

I'm trying to add custom headers using filters on a test grails app. I've setup a filter like this:

Speed java code by moving function to a thread of its own

java multithreading

The following code in the far bottom becomes slow when calling `Moon m = new Moon();.