summary refs log tree commit diff stats
path: root/Classes/ClassicGameMode.m
diff options
context:
space:
mode:
Diffstat (limited to 'Classes/ClassicGameMode.m')
-rwxr-xr-xClasses/ClassicGameMode.m36
1 files changed, 35 insertions, 1 deletions
diff --git a/Classes/ClassicGameMode.m b/Classes/ClassicGameMode.m index e9085f2..0dabbdc 100755 --- a/Classes/ClassicGameMode.m +++ b/Classes/ClassicGameMode.m
@@ -10,9 +10,12 @@
10#import "FallingObject.h" 10#import "FallingObject.h"
11#import "GameOverScene.h" 11#import "GameOverScene.h"
12#import "SimpleAudioEngine.h" 12#import "SimpleAudioEngine.h"
13#import "ScoreBarLayer.h"
13 14
14@implementation ClassicGameMode 15@implementation ClassicGameMode
15 16
17@synthesize score, lives;
18
16typedef enum { 19typedef enum {
17 kCherryObject = 0, 20 kCherryObject = 0,
18 kEnergyDrinkObject, 21 kEnergyDrinkObject,
@@ -181,9 +184,26 @@ static GameModeInfo* info;
181 CCSprite* backgroundImage = [CCSprite spriteWithFile:@"SeaBeach.png"]; 184 CCSprite* backgroundImage = [CCSprite spriteWithFile:@"SeaBeach.png"];
182 backgroundImage.position = ccp(240, 160); 185 backgroundImage.position = ccp(240, 160);
183 [self addChild:backgroundImage z:-1]; 186 [self addChild:backgroundImage z:-1];
184 187
188 score = 0;
189 lives = 3;
185 addSpeed = 2.5f; 190 addSpeed = 2.5f;
186 191
192 ScoreBarLayer* scoreBar = [ScoreBarLayer scoreBar];
193 [self addChild:scoreBar];
194
195 scoreLabel = [CCLabelBMFont labelWithString:@"0" fntFile:@"helvetica2.fnt"];
196 scoreLabel.position = ccp(30,20);
197 [scoreBar addChild:scoreLabel];
198
199 CCSprite* livesImage = [CCSprite spriteWithFile:@"oneup.png"];
200 livesImage.position = ccp(110, 20);
201 [scoreBar addChild:livesImage];
202
203 livesLabel = [CCLabelBMFont labelWithString:@"x3" fntFile:@"helvetica2.fnt"];
204 livesLabel.position = ccp(142,20);
205 [scoreBar addChild:livesLabel];
206
187 [objectFactory createRecipeWithIdentifier:kCherryObject spriteFilename:@"cherry.png" weight:5]; 207 [objectFactory createRecipeWithIdentifier:kCherryObject spriteFilename:@"cherry.png" weight:5];
188 [objectFactory createRecipeWithIdentifier:kEnergyDrinkObject spriteFilename:@"bottle.png" weight:6]; 208 [objectFactory createRecipeWithIdentifier:kEnergyDrinkObject spriteFilename:@"bottle.png" weight:6];
189 [objectFactory createRecipeWithIdentifier:kOneUpObject spriteFilename:@"oneup.png" weight:10]; 209 [objectFactory createRecipeWithIdentifier:kOneUpObject spriteFilename:@"oneup.png" weight:10];
@@ -230,4 +250,18 @@ static GameModeInfo* info;
230 } 250 }
231} 251}
232 252
253- (void)setScore:(int)m_score
254{
255 score = m_score;
256
257 [scoreLabel setString:[NSString stringWithFormat:@"%d", score]];
258}
259
260- (void)setLives:(int)m_lives
261{
262 lives = m_lives;
263
264 [livesLabel setString:[NSString stringWithFormat:@"x%d", lives]];
265}
266
233@end 267@end