From 9f4bf94a763afba795fb991006081505c3ae466b Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Thu, 25 Aug 2011 13:30:00 -0400 Subject: Added Jump to selection screen It currently uses a temporary picture and is unlockable after reaching 5000 points in Collect, at which point a little notification appears at the top of the screen telling you that you've unlocked a new game mode. Also fixed a bug in GameMode with the iteration of objects that would cause the rest of tick to not be called because objects were removed from the set while it was being iterated over. Refs #204 --- Classes/Cart_CollectAppDelegate.m | 4 ++++ Classes/ClassicGameMode.m | 12 ++++++++++++ Classes/GameMode.m | 5 ++++- Classes/GameModeSelectionLayer.m | 15 +++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) (limited to 'Classes') diff --git a/Classes/Cart_CollectAppDelegate.m b/Classes/Cart_CollectAppDelegate.m index ba9d60b..1a6759c 100755 --- a/Classes/Cart_CollectAppDelegate.m +++ b/Classes/Cart_CollectAppDelegate.m @@ -14,6 +14,8 @@ #import "RootViewController.h" #import "MainMenuLayer.h" #import "TestFlight.h" +#import "CCNotifications.h" +#import "notificationDesign.h" @implementation Cart_CollectAppDelegate @@ -64,6 +66,8 @@ CCDirector *director = [CCDirector sharedDirector]; + CCNotifications* notifications = [CCNotifications sharedManager]; + [director setNotificationNode:notifications]; // Init the View Controller viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; diff --git a/Classes/ClassicGameMode.m b/Classes/ClassicGameMode.m index 88c52ce..c1d3be7 100755 --- a/Classes/ClassicGameMode.m +++ b/Classes/ClassicGameMode.m @@ -14,6 +14,7 @@ #import "Rock.h" #import "GameOverScene.h" #import "SimpleAudioEngine.h" +#import "CCNotifications.h" @implementation ClassicGameMode @@ -35,6 +36,17 @@ [self unschedule:@selector(randomlyAddObject:)]; [self schedule:@selector(randomlyAddObject:) interval:0.6f]; addSpeed = 0.6f; + } else if ((lastScore < 5000) && (score >= 5000)) + { + NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; + + if (![defaults boolForKey:@"unlockedJumpMode"]) + { + [[CCNotifications sharedManager] addWithTitle:@"Jump" message:@"You've unlocked a new game mode!" image:@"venice.png"]; + + [defaults setBool:YES forKey:@"unlockedJumpMode"]; + [defaults synchronize]; + } } else if ((lastScore < 4500) && (score >= 4500)) { [self unschedule:@selector(randomlyAddObject:)]; diff --git a/Classes/GameMode.m b/Classes/GameMode.m index 8f695d1..af9b3bd 100644 --- a/Classes/GameMode.m +++ b/Classes/GameMode.m @@ -84,13 +84,16 @@ { [cart tick]; + NSMutableSet* discardedObjects = [NSMutableSet set]; for (FallingObject* object in objects) { if ([object tick]) { - [objects removeObject:object]; + [discardedObjects addObject:object]; } } + + [objects minusSet:discardedObjects]; } - (BOOL)canPause diff --git a/Classes/GameModeSelectionLayer.m b/Classes/GameModeSelectionLayer.m index db08146..3fbf417 100644 --- a/Classes/GameModeSelectionLayer.m +++ b/Classes/GameModeSelectionLayer.m @@ -14,6 +14,7 @@ #import "TutorialMode.h" #import "ClassicGameMode.h" #import "NMPanelMenu.h" +#import "JumpGameMode.h" @implementation GameModeSelectionLayer @@ -56,6 +57,17 @@ [gameModes addObject:collectSelection]; + GameModeSelection* jumpSelection; + + if ([defaults boolForKey:@"unlockedJumpMode"]) + { + jumpSelection = [GameModeSelection selectionWithName:@"Jump" location:@"Venice" filename:@"venice" unlocked:YES]; + } else { + jumpSelection = [GameModeSelection selectionWithName:@"Jump" location:@"Venice" filename:@"venice" unlockCondition:@"Get 5000 points in Collect!"]; + } + + [gameModes addObject:jumpSelection]; + CCMenu* menu = [CCMenu menuWithItems:nil]; float onePanelWide = 128; float padding = 15; @@ -126,6 +138,9 @@ } else if ([gameMode.name isEqual:@"Collect"]) { [[CCDirector sharedDirector] replaceScene:[ClassicGameMode scene]]; + } else if ([gameMode.name isEqual:@"Jump"]) + { + [[CCDirector sharedDirector] replaceScene:[JumpGameMode scene]]; } } -- cgit 1.4.1