diff options
Diffstat (limited to 'Classes/JumpGameMode.m')
-rw-r--r-- | Classes/JumpGameMode.m | 50 |
1 files changed, 9 insertions, 41 deletions
diff --git a/Classes/JumpGameMode.m b/Classes/JumpGameMode.m index bac3fa5..f03eae0 100644 --- a/Classes/JumpGameMode.m +++ b/Classes/JumpGameMode.m | |||
@@ -73,7 +73,7 @@ | |||
73 | { | 73 | { |
74 | [super onEnterTransitionDidFinish]; | 74 | [super onEnterTransitionDidFinish]; |
75 | 75 | ||
76 | [self schedule:@selector(accelerateLedgeScrolling) interval:ledgeAccelerationRate]; | 76 | [self schedule:@selector(accelerateGame) interval:ledgeAccelerationRate]; |
77 | [self schedule:@selector(randomlyAddObject:) interval:addSpeed]; | 77 | [self schedule:@selector(randomlyAddObject:) interval:addSpeed]; |
78 | [self schedule:@selector(incrementScore) interval:1.0f]; | 78 | [self schedule:@selector(incrementScore) interval:1.0f]; |
79 | 79 | ||
@@ -129,8 +129,6 @@ | |||
129 | { | 129 | { |
130 | cart.sprite.position = ccp(cart.sprite.position.x-ledgeScrollSpeed, cart.sprite.position.y); | 130 | cart.sprite.position = ccp(cart.sprite.position.x-ledgeScrollSpeed, cart.sprite.position.y); |
131 | } | 131 | } |
132 | |||
133 | int lastScore = score; | ||
134 | 132 | ||
135 | [super tick:dt]; | 133 | [super tick:dt]; |
136 | 134 | ||
@@ -148,39 +146,6 @@ | |||
148 | [self unscheduleAllSelectors]; | 146 | [self unscheduleAllSelectors]; |
149 | 147 | ||
150 | [[CCDirector sharedDirector] replaceScene:[CCTransitionSlideInT transitionWithDuration:1.5f scene:[GameOverScene sceneWithScore:score gameMode:@"Jump"]]]; | 148 | [[CCDirector sharedDirector] replaceScene:[CCTransitionSlideInT transitionWithDuration:1.5f scene:[GameOverScene sceneWithScore:score gameMode:@"Jump"]]]; |
151 | } else if (score > lastScore) | ||
152 | { | ||
153 | if ((lastScore < 240) && (score >= 240)) | ||
154 | { | ||
155 | [self unschedule:@selector(randomlyAddObject:)]; | ||
156 | [self schedule:@selector(randomlyAddObject:) interval:0.6f]; | ||
157 | addSpeed = 0.6f; | ||
158 | } else if ((lastScore < 180) && (score >= 180)) | ||
159 | { | ||
160 | [self unschedule:@selector(randomlyAddObject:)]; | ||
161 | [self schedule:@selector(randomlyAddObject:) interval:0.7f]; | ||
162 | addSpeed = 0.7f; | ||
163 | } else if ((lastScore < 120) && (score >= 120)) | ||
164 | { | ||
165 | [self unschedule:@selector(randomlyAddObject:)]; | ||
166 | [self schedule:@selector(randomlyAddObject:) interval:0.8f]; | ||
167 | addSpeed = 0.8f; | ||
168 | } else if ((lastScore < 90) && (score >= 90)) | ||
169 | { | ||
170 | [self unschedule:@selector(randomlyAddObject:)]; | ||
171 | [self schedule:@selector(randomlyAddObject:) interval:0.9f]; | ||
172 | addSpeed = 0.9f; | ||
173 | } else if ((lastScore < 60) && (score >= 60)) | ||
174 | { | ||
175 | [self unschedule:@selector(randomlyAddObject:)]; | ||
176 | [self schedule:@selector(randomlyAddObject:) interval:1.0f]; | ||
177 | addSpeed = 1.0f; | ||
178 | } else if ((lastScore < 30) && (score >= 30)) | ||
179 | { | ||
180 | [self unschedule:@selector(randomlyAddObject:)]; | ||
181 | [self schedule:@selector(randomlyAddObject:) interval:2.0f]; | ||
182 | addSpeed = 2.0f; | ||
183 | } | ||
184 | } | 149 | } |
185 | 150 | ||
186 | if (wave) | 151 | if (wave) |
@@ -301,14 +266,17 @@ | |||
301 | return NO; | 266 | return NO; |
302 | } | 267 | } |
303 | 268 | ||
304 | - (void)accelerateLedgeScrolling | 269 | - (void)accelerateGame |
305 | { | 270 | { |
306 | [self unschedule:@selector(accelerateLedgeScrolling)]; | 271 | [self unschedule:@selector(accelerateGame)]; |
272 | [self unschedule:@selector(randomlyAddObject:)]; | ||
307 | 273 | ||
308 | ledgeScrollSpeed += 2; | 274 | ledgeScrollSpeed += 2; |
309 | ledgeAccelerationRate *= 2; | 275 | ledgeAccelerationRate *= 2; |
276 | addSpeed *= 0.8f; | ||
310 | 277 | ||
311 | [self schedule:@selector(accelerateLedgeScrolling) interval:ledgeAccelerationRate]; | 278 | [self schedule:@selector(randomlyAddObject:) interval:addSpeed]; |
279 | [self schedule:@selector(accelerateGame) interval:ledgeAccelerationRate]; | ||
312 | } | 280 | } |
313 | 281 | ||
314 | - (void)randomlyAddObject:(ccTime)dt | 282 | - (void)randomlyAddObject:(ccTime)dt |
@@ -344,7 +312,7 @@ | |||
344 | [objects addObject:object]; | 312 | [objects addObject:object]; |
345 | [object release]; | 313 | [object release]; |
346 | 314 | ||
347 | if (score >= 120) | 315 | if (score >= 240) |
348 | { | 316 | { |
349 | if (arc4random() % 100 > 80) | 317 | if (arc4random() % 100 > 80) |
350 | { | 318 | { |
@@ -360,7 +328,7 @@ | |||
360 | } | 328 | } |
361 | } | 329 | } |
362 | 330 | ||
363 | if (score >= 240) | 331 | if (score >= 480) |
364 | { | 332 | { |
365 | if (arc4random() % 100 > 80) | 333 | if (arc4random() % 100 > 80) |
366 | { | 334 | { |