From fd32f2af7f62f17d42292b6538903a37b0b5e563 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Tue, 23 Aug 2011 13:21:56 -0400 Subject: Added game quitting safeguard to pause screen (version 0.3.1) Also replaced instances of the term "Cart Collect" in Tutorial with "Cartographic". Also modified level selection screen to remember your position in the list rather than simply the last mode you'd played. Closes #211 --- Classes/CocosOverlayScrollView.m | 6 +++++- Classes/GameMode.h | 2 +- Classes/GameMode.m | 12 +++++++++++- Classes/GameModeSelectionLayer.m | 3 --- Classes/TutorialMode.m | 8 ++++---- Resources/Info.plist | 2 +- 6 files changed, 22 insertions(+), 11 deletions(-) diff --git a/Classes/CocosOverlayScrollView.m b/Classes/CocosOverlayScrollView.m index dee9dfe..9db0575 100755 --- a/Classes/CocosOverlayScrollView.m +++ b/Classes/CocosOverlayScrollView.m @@ -100,7 +100,11 @@ - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { - [pageControl setCurrentPage:(NSUInteger)([scrollView contentOffset].x / [scrollView frame].size.width)]; + int currentPage = (NSUInteger)(scrollView.contentOffset.x / scrollView.frame.size.width); + NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; + [defaults setInteger:currentPage forKey:@"lastSelectedMode"]; + + [pageControl setCurrentPage:currentPage]; } @end \ No newline at end of file diff --git a/Classes/GameMode.h b/Classes/GameMode.h index 890106e..53ed9fc 100644 --- a/Classes/GameMode.h +++ b/Classes/GameMode.h @@ -12,7 +12,7 @@ #define GAME_SCENE 436 #define GAME_LAYER 437 -@interface GameMode : CCLayer { +@interface GameMode : CCLayer { NSMutableSet* objects; int score; int lives; diff --git a/Classes/GameMode.m b/Classes/GameMode.m index 7b07f15..8f695d1 100644 --- a/Classes/GameMode.m +++ b/Classes/GameMode.m @@ -146,7 +146,9 @@ - (void)mainmenu { - [[CCDirector sharedDirector] replaceScene:[MainMenuLayer scene]]; + UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Cartographic" message:@"Are you sure you want to quit the currently playing game?" delegate:self cancelButtonTitle:@"Yes" otherButtonTitles:@"No", nil]; + [alert show]; + [alert release]; } - (void)setScore:(int)m_score @@ -179,6 +181,14 @@ delayedAction = nil; } +- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex +{ + if (buttonIndex == 0) + { + [[CCDirector sharedDirector] replaceScene:[MainMenuLayer scene]]; + } +} + - (void)dealloc { [objects release]; diff --git a/Classes/GameModeSelectionLayer.m b/Classes/GameModeSelectionLayer.m index a12d435..4c4845d 100644 --- a/Classes/GameModeSelectionLayer.m +++ b/Classes/GameModeSelectionLayer.m @@ -132,9 +132,6 @@ - (void)didSelectGameMode:(GameModeSelection *)gameMode { - NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; - [defaults setInteger:[gameModes indexOfObject:gameMode] forKey:@"lastSelectedMode"]; - if ([gameMode.name isEqual:@"Tutorial"]) { [[CCDirector sharedDirector] replaceScene:[TutorialMode scene]]; diff --git a/Classes/TutorialMode.m b/Classes/TutorialMode.m index 1285597..3c70a46 100644 --- a/Classes/TutorialMode.m +++ b/Classes/TutorialMode.m @@ -48,7 +48,7 @@ [super onEnterTransitionDidFinish]; [self scheduleDelayedAction:^{ - TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"Welcome to Cart Collect. This is a tutorial designed to help you get started playing the game. Below this bubble is a cart. Tilt your device to move it." name:@"cart" spriteReference:cart.sprite]; + TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"Welcome to Cartographic. This is a tutorial designed to help you get started playing the game. Below this bubble is a cart. Tilt your device to move it." name:@"cart" spriteReference:cart.sprite]; self.currentTutorial = bubble; [bubble release]; } delay:2.0f]; @@ -131,13 +131,13 @@ self.currentTutorial = bubble; [bubble release]; } else { - TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"As you play, Cart Collect gets progressively more intense. Watch what happens when rocks are added to the mix and the speed is turned up." name:@"intense"]; + TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"As you play, Cartographic gets progressively more intense. Watch what happens when rocks are added to the mix and the speed is turned up." name:@"intense"]; self.currentTutorial = bubble; [bubble release]; } } else if (item.sprite.tag == 2010) { - TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"As you play, Cart Collect gets progressively more intense. Watch what happens when rocks are added to the mix and the speed is turned up." name:@"intense"]; + TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"As you play, Cartographic gets progressively more intense. Watch what happens when rocks are added to the mix and the speed is turned up." name:@"intense"]; self.currentTutorial = bubble; [bubble release]; } @@ -324,7 +324,7 @@ } else if (randomItemsDropped == 15) { [self scheduleDelayedAction:^{ - TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"That's pretty much it! You've completed the tutorial, so now it's time to play an actual game of Cart Collect!" name:@"end"]; + TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"That's pretty much it! You've completed the tutorial, so now it's time to play an actual game of Cartographic!" name:@"end"]; self.currentTutorial = bubble; [bubble release]; } delay:2.0f]; diff --git a/Resources/Info.plist b/Resources/Info.plist index 92dca77..28b675a 100755 --- a/Resources/Info.plist +++ b/Resources/Info.plist @@ -27,7 +27,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.3 + 0.3.1 CFBundleSignature ???? CFBundleURLTypes -- cgit 1.4.1