New level wen finished
I've made this little code:
if (levelnum > 3) {
levelnum = 0;
}
[[NSUserDefaults standardUserDefaults] setInteger:levelnum
forKey:@"LevelNum"];
NSLog(@"Levelnum is now %i",levelnum);
//3 load the level, fire up the game
self.controller.level = [Level levelWithNum:levelnum];
[self.controller dealRandomAnagram];
This code is loading up an level linked to an integer. If the integer is
5, it loads up level 5. I don't want that users can skip an level by
closing the app and open it up again. So, how can i make the integer
"LeveNum" one bigger when the level is finished? I am saving and loading
this integer.
I can simple add levelnum=levelnum +1; But than the level is not correct
saved. Thanks for all your help!
No comments:
Post a Comment