From 2ac50443ddbf69b7594808ba4e6de49eecbc0b84 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Mon, 22 Aug 2011 19:52:08 -0400 Subject: 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 --- Classes/GameModeSelectionLayer.m | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Classes/GameModeSelectionLayer.m') 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 @@ [self addChild:tutorialSelection]; NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; - GameModeSelection* collectSelection = [[[GameModeSelection alloc] initWithName:@"Collect" location:@"Paris" filename:@"paris" unlocked:[defaults boolForKey:@"hasDoneTutorial"]] autorelease]; - collectSelection.position = ccp(400-32, 160); + GameModeSelection* collectSelection; - if (collectSelection.unlocked) + if ([defaults boolForKey:@"hasDoneTutorial"]) { const char* sqlQuery = "SELECT * FROM highscores ORDER BY score DESC LIMIT 1"; sqlite3_stmt* compiled_statement; + int score = 0; if (sqlite3_prepare_v2([Cart_CollectAppDelegate database], sqlQuery, -1, &compiled_statement, NULL) == SQLITE_OK) { if (sqlite3_step(compiled_statement) == SQLITE_ROW) { - int score = sqlite3_column_int(compiled_statement, 2); - - [collectSelection setHighscore:score]; + score = sqlite3_column_int(compiled_statement, 2); } } + + collectSelection = [[[GameModeSelection alloc] initWithName:@"Collect" location:@"Paris" filename:@"paris" highscore:score] autorelease]; } else { - [collectSelection setUnlockCondition:@"Beat the tutorial!"]; + collectSelection = [[[GameModeSelection alloc] initWithName:@"Collect" location:@"Paris" filename:@"paris" unlockCondition:@"Beat the tutorial!"] autorelease]; } + collectSelection.position = ccp(320+32,160); [self addChild:collectSelection]; CCMenuItemImage* newgameMenuItem = [CCMenuItemImage itemFromNormalImage:@"back.png" selectedImage:@"back2.png" target:self selector:@selector(mainmenu)]; -- cgit 1.4.1