summary refs log tree commit diff stats
path: root/Classes/GameModeSelectionLayer.m
diff options
context:
space:
mode:
authorStarla Insigna <starla4444@gmail.com>2011-08-22 19:52:08 -0400
committerStarla Insigna <starla4444@gmail.com>2011-08-22 19:52:08 -0400
commit2ac50443ddbf69b7594808ba4e6de49eecbc0b84 (patch)
tree5cdd3a92e9534dd7a2d8b5b52ca9b039587210ea /Classes/GameModeSelectionLayer.m
parent7e84858da5ecb1a445982860ce177c3c91318135 (diff)
downloadcartcollect-2ac50443ddbf69b7594808ba4e6de49eecbc0b84.tar.gz
cartcollect-2ac50443ddbf69b7594808ba4e6de49eecbc0b84.tar.bz2
cartcollect-2ac50443ddbf69b7594808ba4e6de49eecbc0b84.zip
Added borders to level selection images
The image for each level selection now has a tutorial bubble-esque border around it, which was achieved using image masking. The border is included in the graying-out effect when the image is being tapped, and it is also included in the grayscaling when the level is not yet unlocked.

Also rewrote most of the selection drawing code. The titles are now drawn above the image, with Quartz instead of Cocos2D. The highscore label is also drawn with Quartz, though it is still below the image. The unlock condition label no longer appears, and instead, locked levels are now tappable and tapping them shows an alert view containing the unlock condition. Will probably be changed to be more elegant later.

Really, the biggest thing left before the selection screen is done is the ability to scroll through levels. The background also needs changing, but that will come later once I recruit a graphics designer. :P

Refs #207
Diffstat (limited to 'Classes/GameModeSelectionLayer.m')
-rw-r--r--Classes/GameModeSelectionLayer.m15
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)];