diff options
author | Starla Insigna <starla4444@gmail.com> | 2011-08-25 13:30:00 -0400 |
---|---|---|
committer | Starla Insigna <starla4444@gmail.com> | 2011-08-25 13:30:00 -0400 |
commit | 9f4bf94a763afba795fb991006081505c3ae466b (patch) | |
tree | 759a02f12cfabf21ae1ebee1c053b29779e3b1d1 /Classes | |
parent | 55c94570ae9b7a31167705350dde0a4162058f9b (diff) | |
download | cartcollect-9f4bf94a763afba795fb991006081505c3ae466b.tar.gz cartcollect-9f4bf94a763afba795fb991006081505c3ae466b.tar.bz2 cartcollect-9f4bf94a763afba795fb991006081505c3ae466b.zip |
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
Diffstat (limited to 'Classes')
-rwxr-xr-x | Classes/Cart_CollectAppDelegate.m | 4 | ||||
-rwxr-xr-x | Classes/ClassicGameMode.m | 12 | ||||
-rw-r--r-- | Classes/GameMode.m | 5 | ||||
-rw-r--r-- | Classes/GameModeSelectionLayer.m | 15 |
4 files changed, 35 insertions, 1 deletions
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 @@ | |||
14 | #import "RootViewController.h" | 14 | #import "RootViewController.h" |
15 | #import "MainMenuLayer.h" | 15 | #import "MainMenuLayer.h" |
16 | #import "TestFlight.h" | 16 | #import "TestFlight.h" |
17 | #import "CCNotifications.h" | ||
18 | #import "notificationDesign.h" | ||
17 | 19 | ||
18 | @implementation Cart_CollectAppDelegate | 20 | @implementation Cart_CollectAppDelegate |
19 | 21 | ||
@@ -64,6 +66,8 @@ | |||
64 | 66 | ||
65 | 67 | ||
66 | CCDirector *director = [CCDirector sharedDirector]; | 68 | CCDirector *director = [CCDirector sharedDirector]; |
69 | CCNotifications* notifications = [CCNotifications sharedManager]; | ||
70 | [director setNotificationNode:notifications]; | ||
67 | 71 | ||
68 | // Init the View Controller | 72 | // Init the View Controller |
69 | viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; | 73 | 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 @@ | |||
14 | #import "Rock.h" | 14 | #import "Rock.h" |
15 | #import "GameOverScene.h" | 15 | #import "GameOverScene.h" |
16 | #import "SimpleAudioEngine.h" | 16 | #import "SimpleAudioEngine.h" |
17 | #import "CCNotifications.h" | ||
17 | 18 | ||
18 | @implementation ClassicGameMode | 19 | @implementation ClassicGameMode |
19 | 20 | ||
@@ -35,6 +36,17 @@ | |||
35 | [self unschedule:@selector(randomlyAddObject:)]; | 36 | [self unschedule:@selector(randomlyAddObject:)]; |
36 | [self schedule:@selector(randomlyAddObject:) interval:0.6f]; | 37 | [self schedule:@selector(randomlyAddObject:) interval:0.6f]; |
37 | addSpeed = 0.6f; | 38 | addSpeed = 0.6f; |
39 | } else if ((lastScore < 5000) && (score >= 5000)) | ||
40 | { | ||
41 | NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | ||
42 | |||
43 | if (![defaults boolForKey:@"unlockedJumpMode"]) | ||
44 | { | ||
45 | [[CCNotifications sharedManager] addWithTitle:@"Jump" message:@"You've unlocked a new game mode!" image:@"venice.png"]; | ||
46 | |||
47 | [defaults setBool:YES forKey:@"unlockedJumpMode"]; | ||
48 | [defaults synchronize]; | ||
49 | } | ||
38 | } else if ((lastScore < 4500) && (score >= 4500)) | 50 | } else if ((lastScore < 4500) && (score >= 4500)) |
39 | { | 51 | { |
40 | [self unschedule:@selector(randomlyAddObject:)]; | 52 | [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 @@ | |||
84 | { | 84 | { |
85 | [cart tick]; | 85 | [cart tick]; |
86 | 86 | ||
87 | NSMutableSet* discardedObjects = [NSMutableSet set]; | ||
87 | for (FallingObject* object in objects) | 88 | for (FallingObject* object in objects) |
88 | { | 89 | { |
89 | if ([object tick]) | 90 | if ([object tick]) |
90 | { | 91 | { |
91 | [objects removeObject:object]; | 92 | [discardedObjects addObject:object]; |
92 | } | 93 | } |
93 | } | 94 | } |
95 | |||
96 | [objects minusSet:discardedObjects]; | ||
94 | } | 97 | } |
95 | 98 | ||
96 | - (BOOL)canPause | 99 | - (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 @@ | |||
14 | #import "TutorialMode.h" | 14 | #import "TutorialMode.h" |
15 | #import "ClassicGameMode.h" | 15 | #import "ClassicGameMode.h" |
16 | #import "NMPanelMenu.h" | 16 | #import "NMPanelMenu.h" |
17 | #import "JumpGameMode.h" | ||
17 | 18 | ||
18 | @implementation GameModeSelectionLayer | 19 | @implementation GameModeSelectionLayer |
19 | 20 | ||
@@ -56,6 +57,17 @@ | |||
56 | 57 | ||
57 | [gameModes addObject:collectSelection]; | 58 | [gameModes addObject:collectSelection]; |
58 | 59 | ||
60 | GameModeSelection* jumpSelection; | ||
61 | |||
62 | if ([defaults boolForKey:@"unlockedJumpMode"]) | ||
63 | { | ||
64 | jumpSelection = [GameModeSelection selectionWithName:@"Jump" location:@"Venice" filename:@"venice" unlocked:YES]; | ||
65 | } else { | ||
66 | jumpSelection = [GameModeSelection selectionWithName:@"Jump" location:@"Venice" filename:@"venice" unlockCondition:@"Get 5000 points in Collect!"]; | ||
67 | } | ||
68 | |||
69 | [gameModes addObject:jumpSelection]; | ||
70 | |||
59 | CCMenu* menu = [CCMenu menuWithItems:nil]; | 71 | CCMenu* menu = [CCMenu menuWithItems:nil]; |
60 | float onePanelWide = 128; | 72 | float onePanelWide = 128; |
61 | float padding = 15; | 73 | float padding = 15; |
@@ -126,6 +138,9 @@ | |||
126 | } else if ([gameMode.name isEqual:@"Collect"]) | 138 | } else if ([gameMode.name isEqual:@"Collect"]) |
127 | { | 139 | { |
128 | [[CCDirector sharedDirector] replaceScene:[ClassicGameMode scene]]; | 140 | [[CCDirector sharedDirector] replaceScene:[ClassicGameMode scene]]; |
141 | } else if ([gameMode.name isEqual:@"Jump"]) | ||
142 | { | ||
143 | [[CCDirector sharedDirector] replaceScene:[JumpGameMode scene]]; | ||
129 | } | 144 | } |
130 | } | 145 | } |
131 | 146 | ||