ios - Is this the right way to have multiple levels unlocked? -


Working on the game for iOS with many levels I'm playing around and this is who I came with :

To save the level:

  - Gameigned {_touched = YES; If (_touched == yes) {beatLevel = YES; NSLog (@ "touched"); [Self-Run Action: [SKAction Sequence: @ [[SKAPAD RUNBLOCK: ^ {level2Achieved = [NSUser Defaults Standard User Defaults] IntegerForiki: @ "New Lived Achieved"]; If (beatLevel == Yes) {level2Achieved = 2; } [[NSUserDefaults standard user default] setInteger: received for level2: @ "newLevelAchieved"]; [[NSUserDefaults Standard User Defaults] Synchronize]; }], [SAKAP waits: 0.5], [sketcheon runblock: ^ {MyScen * menmanu = [[MySsen Alok] Init with size: autos]; [Self.view presentScene: Main Menu Infection: [STTransformation Feedback: 0.6]]; }],]]]; }}  

Then I've imported the header file in my main menu (where 1-40 levels have been selected), and set the following code to see if Next level is selected:

// Set up level achieved: level2Achieved = [[NSUserDefaults Standard Standard Defaults] integerForKey: @ "newLevelAchieved"];

plus if a statement goes at the user level to tap to see if it has been unlocked or not:

  if ([Node.name is EqualToString: @ "LV2"] & amp; amp; level 2 is achieved == 2) {testScene2 * firstLevel = [[testScene2 alloc] initWithSize: self.size]; [Self.view presentScene: First Level Infection: [STTransportation Feedidy Collar: [Scholar White Collar] Duration: 0.5]]; }  

It used to work for me but before I do it for the next 38 levels, is it the right way to do it? What else have I written in

  // set up level: received levelXAchieved = [[NSUserDefaults StandardUserDefaults] integerForKey: @ "newLevelAchieved"];  

For each new level? Is there a way to do this with an NSMutableArray? Or forgot a way to override NSUserDefaults without the program that the previous level was also unlocked ?? Try creating a NSMutableArray

and every time the player has a new If the level is received, then add a value that is NSString, then check whether NSString is at a level, before the player clicks on that level?


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -