summary refs log tree commit diff stats
path: root/Classes/JumpGameMode.m
diff options
context:
space:
mode:
authorStarla Insigna <starla4444@gmail.com>2011-11-30 12:57:06 -0500
committerStarla Insigna <starla4444@gmail.com>2011-11-30 12:57:06 -0500
commit6e96fb2144718722208d22f892716b55548135e1 (patch)
tree4dd550de787dd370a13039c03969442f54a3a856 /Classes/JumpGameMode.m
parentfd58a0cde1bb5473e39e6cb82d28113da84b9ae0 (diff)
downloadcartcollect-6e96fb2144718722208d22f892716b55548135e1.tar.gz
cartcollect-6e96fb2144718722208d22f892716b55548135e1.tar.bz2
cartcollect-6e96fb2144718722208d22f892716b55548135e1.zip
Created a game mode manager
There is now one location for information relating to each GameMode instead of several places, so that info can be easily updated and propagated to, for instance, GameModeSelectionLayer. GameModes can also be specified by an info instance each owns. There's also a way to get an ordered list of game modes.

The three star game mode unlocking system has also been added.

Closes #213
Diffstat (limited to 'Classes/JumpGameMode.m')
-rw-r--r--Classes/JumpGameMode.m22
1 files changed, 21 insertions, 1 deletions
diff --git a/Classes/JumpGameMode.m b/Classes/JumpGameMode.m index a5c2b8f..b1c5989 100644 --- a/Classes/JumpGameMode.m +++ b/Classes/JumpGameMode.m
@@ -35,6 +35,26 @@ typedef enum {
35 kPointMultiplierObject 35 kPointMultiplierObject
36} FallingObjects; 36} FallingObjects;
37 37
38static GameModeInfo* info;
39
40+ (GameModeInfo*)info
41{
42 if (info == nil)
43 {
44 info = [[GameModeInfo alloc] initWithName:@"Jump"
45 location:@"Venice"
46 numOfStars:3
47 imageFilename:[[NSBundle mainBundle] pathForResource:@"venice" ofType:@"png"]
48 unlocked:NO
49 unlockCondition:@"Get 2000 points in Collect!"
50 gameClass:[JumpGameMode class]
51 globalHighscoreKey:@"Jump"
52 starsToUnlock:2];
53 }
54
55 return info;
56}
57
38- (id)init 58- (id)init
39{ 59{
40 self = [super init]; 60 self = [super init];
@@ -208,7 +228,7 @@ typedef enum {
208 { 228 {
209 [self unscheduleAllSelectors]; 229 [self unscheduleAllSelectors];
210 230
211 [[CCDirector sharedDirector] replaceScene:[CCTransitionSlideInT transitionWithDuration:1.5f scene:[GameOverScene sceneWithScore:score gameMode:@"Jump"]]]; 231 [[CCDirector sharedDirector] replaceScene:[CCTransitionSlideInT transitionWithDuration:1.5f scene:[GameOverScene sceneWithScore:score gameMode:[JumpGameMode info]]]];
212 } 232 }
213 233
214 if (wave) 234 if (wave)