From ab9f7381455b334fa0df563e21775410be74ea45 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Sat, 10 Sep 2011 10:04:18 -0400 Subject: Added point multipliers There is support for point multipliers for any game mode, but only Jump currently utilizes it. Closes #222 --- Classes/JumpGameMode.m | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) (limited to 'Classes/JumpGameMode.m') 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 @@ #import "OneUp.h" #import "Rock.h" #import "GameOverScene.h" +#import "PointMultiplier.h" #define kMinimumGestureLength 25 @@ -308,26 +309,17 @@ { FallingObject* object; - if (score < 120) - { - int randomval = arc4random()%100; - - if (randomval < 80) - { - object = [[Rock alloc] init]; - } else { - object = [[OneUp alloc] init]; - } - } else { - int randomval = arc4random()%100; - - if (randomval < 70) - { - object = [[Rock alloc] init]; - } else { - object = [[OneUp alloc] init]; - } - } + int randomval = arc4random()%100; + + if (randomval < 50) + { + object = [[Rock alloc] init]; + } else if (randomval < 75) + { + object = [[PointMultiplier alloc] init]; + } else { + object = [[OneUp alloc] init]; + } int objectX; @@ -434,7 +426,19 @@ - (void)incrementScore { - [self setScore:self.score+1]; + [self setScore:self.score+pointMultiplier]; +} + +- (void)setLives:(int)m_lives +{ + int oldLives = lives; + + [super setLives:m_lives]; + + if (oldLives > lives) + { + [self setPointMultiplier:1]; + } } @end -- cgit 1.4.1