diff options
author | Starla Insigna <starla4444@gmail.com> | 2011-09-10 10:04:18 -0400 |
---|---|---|
committer | Starla Insigna <starla4444@gmail.com> | 2011-09-10 10:04:18 -0400 |
commit | ab9f7381455b334fa0df563e21775410be74ea45 (patch) | |
tree | 531ffb35abf20c8a75103a66c7de0a7136b11d24 /Classes/JumpGameMode.m | |
parent | b090d12d637e5cfbf0ac6955fa6c8d401de657b5 (diff) | |
download | cartcollect-ab9f7381455b334fa0df563e21775410be74ea45.tar.gz cartcollect-ab9f7381455b334fa0df563e21775410be74ea45.tar.bz2 cartcollect-ab9f7381455b334fa0df563e21775410be74ea45.zip |
Added point multipliers
There is support for point multipliers for any game mode, but only Jump currently utilizes it. Closes #222
Diffstat (limited to 'Classes/JumpGameMode.m')
-rw-r--r-- | Classes/JumpGameMode.m | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/Classes/JumpGameMode.m b/Classes/JumpGameMode.m index 0cf916a..9076426 100644 --- a/Classes/JumpGameMode.m +++ b/Classes/JumpGameMode.m | |||
@@ -14,6 +14,7 @@ | |||
14 | #import "OneUp.h" | 14 | #import "OneUp.h" |
15 | #import "Rock.h" | 15 | #import "Rock.h" |
16 | #import "GameOverScene.h" | 16 | #import "GameOverScene.h" |
17 | #import "PointMultiplier.h" | ||
17 | 18 | ||
18 | #define kMinimumGestureLength 25 | 19 | #define kMinimumGestureLength 25 |
19 | 20 | ||
@@ -308,26 +309,17 @@ | |||
308 | { | 309 | { |
309 | FallingObject* object; | 310 | FallingObject* object; |
310 | 311 | ||
311 | if (score < 120) | 312 | int randomval = arc4random()%100; |
312 | { | 313 | |
313 | int randomval = arc4random()%100; | 314 | if (randomval < 50) |
314 | 315 | { | |
315 | if (randomval < 80) | 316 | object = [[Rock alloc] init]; |
316 | { | 317 | } else if (randomval < 75) |
317 | object = [[Rock alloc] init]; | 318 | { |
318 | } else { | 319 | object = [[PointMultiplier alloc] init]; |
319 | object = [[OneUp alloc] init]; | 320 | } else { |
320 | } | 321 | object = [[OneUp alloc] init]; |
321 | } else { | 322 | } |
322 | int randomval = arc4random()%100; | ||
323 | |||
324 | if (randomval < 70) | ||
325 | { | ||
326 | object = [[Rock alloc] init]; | ||
327 | } else { | ||
328 | object = [[OneUp alloc] init]; | ||
329 | } | ||
330 | } | ||
331 | 323 | ||
332 | int objectX; | 324 | int objectX; |
333 | 325 | ||
@@ -434,7 +426,19 @@ | |||
434 | 426 | ||
435 | - (void)incrementScore | 427 | - (void)incrementScore |
436 | { | 428 | { |
437 | [self setScore:self.score+1]; | 429 | [self setScore:self.score+pointMultiplier]; |
430 | } | ||
431 | |||
432 | - (void)setLives:(int)m_lives | ||
433 | { | ||
434 | int oldLives = lives; | ||
435 | |||
436 | [super setLives:m_lives]; | ||
437 | |||
438 | if (oldLives > lives) | ||
439 | { | ||
440 | [self setPointMultiplier:1]; | ||
441 | } | ||
438 | } | 442 | } |
439 | 443 | ||
440 | @end | 444 | @end |