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

Load HashMap values from Xml file

java xml java-ee

How to load a hashmap from your XML and inject it into a real object in JAVA

refer one style item to another style item

android android-styles

Is there a possibility to refer one style item to another style item? For example:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.