diff options
Diffstat (limited to 'Classes/GameModeSelectionLayer.m')
| -rw-r--r-- | Classes/GameModeSelectionLayer.m | 15 |
1 files changed, 8 insertions, 7 deletions
| diff --git a/Classes/GameModeSelectionLayer.m b/Classes/GameModeSelectionLayer.m index 3e1995e..a90606e 100644 --- a/Classes/GameModeSelectionLayer.m +++ b/Classes/GameModeSelectionLayer.m | |||
| @@ -42,27 +42,28 @@ | |||
| 42 | [self addChild:tutorialSelection]; | 42 | [self addChild:tutorialSelection]; |
| 43 | 43 | ||
| 44 | NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | 44 | NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; |
| 45 | GameModeSelection* collectSelection = [[[GameModeSelection alloc] initWithName:@"Collect" location:@"Paris" filename:@"paris" unlocked:[defaults boolForKey:@"hasDoneTutorial"]] autorelease]; | 45 | GameModeSelection* collectSelection; |
| 46 | collectSelection.position = ccp(400-32, 160); | ||
| 47 | 46 | ||
| 48 | if (collectSelection.unlocked) | 47 | if ([defaults boolForKey:@"hasDoneTutorial"]) |
| 49 | { | 48 | { |
| 50 | const char* sqlQuery = "SELECT * FROM highscores ORDER BY score DESC LIMIT 1"; | 49 | const char* sqlQuery = "SELECT * FROM highscores ORDER BY score DESC LIMIT 1"; |
| 51 | sqlite3_stmt* compiled_statement; | 50 | sqlite3_stmt* compiled_statement; |
| 51 | int score = 0; | ||
| 52 | 52 | ||
| 53 | if (sqlite3_prepare_v2([Cart_CollectAppDelegate database], sqlQuery, -1, &compiled_statement, NULL) == SQLITE_OK) | 53 | if (sqlite3_prepare_v2([Cart_CollectAppDelegate database], sqlQuery, -1, &compiled_statement, NULL) == SQLITE_OK) |
| 54 | { | 54 | { |
| 55 | if (sqlite3_step(compiled_statement) == SQLITE_ROW) | 55 | if (sqlite3_step(compiled_statement) == SQLITE_ROW) |
| 56 | { | 56 | { |
| 57 | int score = sqlite3_column_int(compiled_statement, 2); | 57 | score = sqlite3_column_int(compiled_statement, 2); |
| 58 | |||
| 59 | [collectSelection setHighscore:score]; | ||
| 60 | } | 58 | } |
| 61 | } | 59 | } |
| 60 | |||
| 61 | collectSelection = [[[GameModeSelection alloc] initWithName:@"Collect" location:@"Paris" filename:@"paris" highscore:score] autorelease]; | ||
| 62 | } else { | 62 | } else { |
| 63 | [collectSelection setUnlockCondition:@"Beat the tutorial!"]; | 63 | collectSelection = [[[GameModeSelection alloc] initWithName:@"Collect" location:@"Paris" filename:@"paris" unlockCondition:@"Beat the tutorial!"] autorelease]; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | collectSelection.position = ccp(320+32,160); | ||
| 66 | [self addChild:collectSelection]; | 67 | [self addChild:collectSelection]; |
| 67 | 68 | ||
| 68 | CCMenuItemImage* newgameMenuItem = [CCMenuItemImage itemFromNormalImage:@"back.png" selectedImage:@"back2.png" target:self selector:@selector(mainmenu)]; | 69 | CCMenuItemImage* newgameMenuItem = [CCMenuItemImage itemFromNormalImage:@"back.png" selectedImage:@"back2.png" target:self selector:@selector(mainmenu)]; |
