summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStarla Insigna <starla4444@gmail.com>2013-01-04 12:40:49 -0500
committerStarla Insigna <starla4444@gmail.com>2013-01-04 12:40:49 -0500
commit964cad39cd7373a320516914cbcb0c4207ed4e64 (patch)
tree9aa9b7c0c9cd7ff61dc2f6c1930a36a5987b951a
parentade84cf3d464f6f1dc2becf16602db759d689398 (diff)
downloadcartcollect-964cad39cd7373a320516914cbcb0c4207ed4e64.tar.gz
cartcollect-964cad39cd7373a320516914cbcb0c4207ed4e64.tar.bz2
cartcollect-964cad39cd7373a320516914cbcb0c4207ed4e64.zip
Added third star to Collect and added failsafe for GameModeInfo's init in case numOfStars is over 3
-rwxr-xr-xClasses/ClassicGameMode.m5
-rw-r--r--Classes/GameModeInfo.m5
2 files changed, 9 insertions, 1 deletions
diff --git a/Classes/ClassicGameMode.m b/Classes/ClassicGameMode.m index 00bf049..e9085f2 100755 --- a/Classes/ClassicGameMode.m +++ b/Classes/ClassicGameMode.m
@@ -51,7 +51,10 @@ static GameModeInfo* info;
51 [[CCDirector sharedDirector] replaceScene:[CCTransitionSlideInT transitionWithDuration:1.5f scene:[GameOverScene sceneWithScore:score gameMode:[ClassicGameMode info]]]]; 51 [[CCDirector sharedDirector] replaceScene:[CCTransitionSlideInT transitionWithDuration:1.5f scene:[GameOverScene sceneWithScore:score gameMode:[ClassicGameMode info]]]];
52 } else if (score > lastScore) 52 } else if (score > lastScore)
53 { 53 {
54 if ((lastScore < 6500) && (score >= 6500)) 54 if ((lastScore < 10000) && (score >= 10000))
55 {
56 [[ClassicGameMode info] setStar:2 withMessage:@"Get 10000 points"];
57 } else if ((lastScore < 6500) && (score >= 6500))
55 { 58 {
56 [self unschedule:@selector(randomlyAddObject:)]; 59 [self unschedule:@selector(randomlyAddObject:)];
57 [self schedule:@selector(randomlyAddObject:) interval:0.6f]; 60 [self schedule:@selector(randomlyAddObject:) interval:0.6f];
diff --git a/Classes/GameModeInfo.m b/Classes/GameModeInfo.m index 08b95e5..91543fa 100644 --- a/Classes/GameModeInfo.m +++ b/Classes/GameModeInfo.m
@@ -34,6 +34,11 @@
34 unlocked = m_unlocked; 34 unlocked = m_unlocked;
35 } 35 }
36 36
37 if (numOfStars > 3)
38 {
39 @throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"There does not exist support for more than three stars in a game mode." userInfo:nil];
40 }
41
37 stars = (BOOL*) calloc(numOfStars, sizeof(BOOL)); 42 stars = (BOOL*) calloc(numOfStars, sizeof(BOOL));
38 for (int i=0; i<numOfStars; i++) 43 for (int i=0; i<numOfStars; i++)
39 { 44 {