summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xCartographic.xcodeproj/project.pbxproj6
-rwxr-xr-xClasses/ClassicGameMode.h7
-rwxr-xr-xClasses/ClassicGameMode.m36
-rw-r--r--Classes/GameMode.h12
-rw-r--r--Classes/GameMode.m45
-rw-r--r--Classes/JumpGameMode.h10
-rw-r--r--Classes/JumpGameMode.m54
-rw-r--r--Classes/ScoreBarLayer.h19
-rw-r--r--Classes/ScoreBarLayer.m41
-rw-r--r--Classes/TutorialMode.h7
-rw-r--r--Classes/TutorialMode.m36
11 files changed, 211 insertions, 62 deletions
diff --git a/Cartographic.xcodeproj/project.pbxproj b/Cartographic.xcodeproj/project.pbxproj index 32912ef..1513954 100755 --- a/Cartographic.xcodeproj/project.pbxproj +++ b/Cartographic.xcodeproj/project.pbxproj
@@ -122,6 +122,7 @@
122 6C85834014055A44009EF100 /* CCNotifications.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C85833F14055A44009EF100 /* CCNotifications.m */; }; 122 6C85834014055A44009EF100 /* CCNotifications.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C85833F14055A44009EF100 /* CCNotifications.m */; };
123 6C85834414055B2E009EF100 /* notificationDesign.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C85834314055B2E009EF100 /* notificationDesign.m */; }; 123 6C85834414055B2E009EF100 /* notificationDesign.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C85834314055B2E009EF100 /* notificationDesign.m */; };
124 6C85834614056E57009EF100 /* venice.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C85834514056E57009EF100 /* venice.png */; }; 124 6C85834614056E57009EF100 /* venice.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C85834514056E57009EF100 /* venice.png */; };
125 6C91A8781697745A00939EA1 /* ScoreBarLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C91A8771697745A00939EA1 /* ScoreBarLayer.m */; };
125 6CC89DD913F2F4E6003704F7 /* Entitlements.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6CC89DD813F2F4E6003704F7 /* Entitlements.plist */; }; 126 6CC89DD913F2F4E6003704F7 /* Entitlements.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6CC89DD813F2F4E6003704F7 /* Entitlements.plist */; };
126 6CC89DDF13F31413003704F7 /* TutorialMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CC89DDE13F31413003704F7 /* TutorialMode.m */; }; 127 6CC89DDF13F31413003704F7 /* TutorialMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CC89DDE13F31413003704F7 /* TutorialMode.m */; };
127 6CDBE80C14092DB00072F287 /* ledge.png in Resources */ = {isa = PBXBuildFile; fileRef = 6CDBE80B14092DB00072F287 /* ledge.png */; }; 128 6CDBE80C14092DB00072F287 /* ledge.png in Resources */ = {isa = PBXBuildFile; fileRef = 6CDBE80B14092DB00072F287 /* ledge.png */; };
@@ -459,6 +460,8 @@
459 6C85834314055B2E009EF100 /* notificationDesign.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = notificationDesign.m; sourceTree = "<group>"; }; 460 6C85834314055B2E009EF100 /* notificationDesign.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = notificationDesign.m; sourceTree = "<group>"; };
460 6C85834514056E57009EF100 /* venice.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = venice.png; sourceTree = "<group>"; }; 461 6C85834514056E57009EF100 /* venice.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = venice.png; sourceTree = "<group>"; };
461 6C88B69314119B5A0049E402 /* libTestFlight.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libTestFlight.a; sourceTree = "<group>"; }; 462 6C88B69314119B5A0049E402 /* libTestFlight.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libTestFlight.a; sourceTree = "<group>"; };
463 6C91A8761697745A00939EA1 /* ScoreBarLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScoreBarLayer.h; sourceTree = "<group>"; };
464 6C91A8771697745A00939EA1 /* ScoreBarLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScoreBarLayer.m; sourceTree = "<group>"; };
462 6CB532581403BA4F00780A5E /* GameModeSelectionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameModeSelectionDelegate.h; sourceTree = "<group>"; }; 465 6CB532581403BA4F00780A5E /* GameModeSelectionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameModeSelectionDelegate.h; sourceTree = "<group>"; };
463 6CC89DD813F2F4E6003704F7 /* Entitlements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Entitlements.plist; sourceTree = "<group>"; }; 466 6CC89DD813F2F4E6003704F7 /* Entitlements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Entitlements.plist; sourceTree = "<group>"; };
464 6CC89DDD13F31413003704F7 /* TutorialMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TutorialMode.h; sourceTree = "<group>"; }; 467 6CC89DDD13F31413003704F7 /* TutorialMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TutorialMode.h; sourceTree = "<group>"; };
@@ -778,6 +781,8 @@
778 3F03221813D7904E00E6A708 /* Highscore.m */, 781 3F03221813D7904E00E6A708 /* Highscore.m */,
779 6C29040E13EAEB590032DA0F /* TutorialBubble.h */, 782 6C29040E13EAEB590032DA0F /* TutorialBubble.h */,
780 6C29040F13EAEB590032DA0F /* TutorialBubble.m */, 783 6C29040F13EAEB590032DA0F /* TutorialBubble.m */,
784 6C91A8761697745A00939EA1 /* ScoreBarLayer.h */,
785 6C91A8771697745A00939EA1 /* ScoreBarLayer.m */,
781 ); 786 );
782 path = Classes; 787 path = Classes;
783 sourceTree = "<group>"; 788 sourceTree = "<group>";
@@ -1545,6 +1550,7 @@
1545 6CF64C1D141BFA9600F3B702 /* FallingObjectFactory.m in Sources */, 1550 6CF64C1D141BFA9600F3B702 /* FallingObjectFactory.m in Sources */,
1546 6CE5F7EA1483FAC8008E9ADA /* GameModeInfo.m in Sources */, 1551 6CE5F7EA1483FAC8008E9ADA /* GameModeInfo.m in Sources */,
1547 6CE5F7EE14855331008E9ADA /* GameModeManager.m in Sources */, 1552 6CE5F7EE14855331008E9ADA /* GameModeManager.m in Sources */,
1553 6C91A8781697745A00939EA1 /* ScoreBarLayer.m in Sources */,
1548 ); 1554 );
1549 runOnlyForDeploymentPostprocessing = 0; 1555 runOnlyForDeploymentPostprocessing = 0;
1550 }; 1556 };
diff --git a/Classes/ClassicGameMode.h b/Classes/ClassicGameMode.h index 898a5e7..018588d 100755 --- a/Classes/ClassicGameMode.h +++ b/Classes/ClassicGameMode.h
@@ -12,9 +12,16 @@
12#import "FallingObjectDelegate.h" 12#import "FallingObjectDelegate.h"
13 13
14@interface ClassicGameMode : GameMode <FallingObjectDelegate> { 14@interface ClassicGameMode : GameMode <FallingObjectDelegate> {
15 int score;
16 int lives;
17 CCLabelBMFont* scoreLabel;
18 CCLabelBMFont* livesLabel;
19
15 float addSpeed; 20 float addSpeed;
16} 21}
17 22
23@property (nonatomic) int score;
24@property (nonatomic) int lives;
18- (id)init; 25- (id)init;
19- (void)randomlyAddObject:(ccTime)dt; 26- (void)randomlyAddObject:(ccTime)dt;
20 27
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
diff --git a/Classes/GameMode.h b/Classes/GameMode.h index ae3fbe5..6421099 100644 --- a/Classes/GameMode.h +++ b/Classes/GameMode.h
@@ -17,10 +17,7 @@
17 17
18@interface GameMode : CCLayer <UIAlertViewDelegate, CartDelegate, CCStandardTouchDelegate> { 18@interface GameMode : CCLayer <UIAlertViewDelegate, CartDelegate, CCStandardTouchDelegate> {
19 NSMutableSet* objects; 19 NSMutableSet* objects;
20 int score; 20 Cart* cart;
21 int lives;
22 int pointMultiplier;
23 Cart* cart;
24 FallingObjectFactory* objectFactory; 21 FallingObjectFactory* objectFactory;
25 22
26 CCLayerColor* willPauseLayer; 23 CCLayerColor* willPauseLayer;
@@ -29,9 +26,6 @@
29 BOOL isPaused; 26 BOOL isPaused;
30 BOOL isPausing; 27 BOOL isPausing;
31 28
32 CCLabelBMFont* scoreLabel;
33 CCLabelBMFont* livesLabel;
34
35 void (^delayedAction)(void); 29 void (^delayedAction)(void);
36 30
37 BOOL hasGyroscope; 31 BOOL hasGyroscope;
@@ -43,10 +37,6 @@
43} 37}
44 38
45@property (readonly) Cart* cart; 39@property (readonly) Cart* cart;
46@property (nonatomic,assign) int score;
47@property (nonatomic,assign) int lives;
48@property (nonatomic,assign) int pointMultiplier;
49@property (readonly) BOOL isPaused;
50- (void)tick:(ccTime)dt; 40- (void)tick:(ccTime)dt;
51- (BOOL)canPause; 41- (BOOL)canPause;
52- (void)pause; 42- (void)pause;
diff --git a/Classes/GameMode.m b/Classes/GameMode.m index ca269cd..956e512 100644 --- a/Classes/GameMode.m +++ b/Classes/GameMode.m
@@ -12,7 +12,7 @@
12 12
13@implementation GameMode 13@implementation GameMode
14 14
15@synthesize cart, score, lives, isPaused, pointMultiplier; 15@synthesize cart;
16 16
17- (id)init 17- (id)init
18{ 18{
@@ -28,18 +28,6 @@
28 cart.delegate = self; 28 cart.delegate = self;
29 [self addChild:cart.sprite]; 29 [self addChild:cart.sprite];
30 30
31 scoreLabel = [CCLabelBMFont labelWithString:@"Score: 0" fntFile:@"helvetica2.fnt"];
32 scoreLabel.position = ccp(50, 300);
33 [self addChild:scoreLabel];
34
35 livesLabel = [CCLabelBMFont labelWithString:@"Lives: 3" fntFile:@"helvetica2.fnt"];
36 livesLabel.position = ccp(50, 280);
37 [self addChild:livesLabel];
38
39 score = 0;
40 lives = 3;
41 pointMultiplier = 1;
42
43 objectFactory = [[FallingObjectFactory alloc] init]; 31 objectFactory = [[FallingObjectFactory alloc] init];
44 32
45 isPaused = NO; 33 isPaused = NO;
@@ -187,37 +175,6 @@
187 [alert release]; 175 [alert release];
188} 176}
189 177
190- (void)setScore:(int)m_score
191{
192 score = m_score;
193
194 if (pointMultiplier > 1)
195 {
196 [scoreLabel setString:[NSString stringWithFormat:@"Score: %d x%d", score, pointMultiplier]];
197 } else {
198 [scoreLabel setString:[NSString stringWithFormat:@"Score: %d", score]];
199 }
200}
201
202- (void)setLives:(int)m_lives
203{
204 lives = m_lives;
205
206 [livesLabel setString:[NSString stringWithFormat:@"Lives: %d", lives]];
207}
208
209- (void)setPointMultiplier:(int)m_pointMultiplier
210{
211 pointMultiplier = m_pointMultiplier;
212
213 if (pointMultiplier > 1)
214 {
215 [scoreLabel setString:[NSString stringWithFormat:@"Score: %d x%d", score, pointMultiplier]];
216 } else {
217 [scoreLabel setString:[NSString stringWithFormat:@"Score: %d", score]];
218 }
219}
220
221- (void)scheduleDelayedAction:(void(^)(void))m_delayedAction delay:(float)delay 178- (void)scheduleDelayedAction:(void(^)(void))m_delayedAction delay:(float)delay
222{ 179{
223 delayedAction = Block_copy([m_delayedAction retain]); 180 delayedAction = Block_copy([m_delayedAction retain]);
diff --git a/Classes/JumpGameMode.h b/Classes/JumpGameMode.h index a09bbea..7502a28 100644 --- a/Classes/JumpGameMode.h +++ b/Classes/JumpGameMode.h
@@ -23,8 +23,18 @@
23 int ledgeScrollSpeed; 23 int ledgeScrollSpeed;
24 float ledgeAccelerationRate; 24 float ledgeAccelerationRate;
25 float addSpeed; 25 float addSpeed;
26
27 int score;
28 int lives;
29 int pointMultiplier;
30 CCLabelBMFont* scoreLabel;
31 CCLabelBMFont* livesLabel;
32 CCLabelBMFont* pointMultiplierLabel;
26} 33}
27 34
35@property (nonatomic) int score;
36@property (nonatomic) int lives;
37@property (nonatomic) int pointMultiplier;
28- (void)accelerateGame; 38- (void)accelerateGame;
29- (void)randomlyAddObject:(ccTime)dt; 39- (void)randomlyAddObject:(ccTime)dt;
30- (void)incrementScore; 40- (void)incrementScore;
diff --git a/Classes/JumpGameMode.m b/Classes/JumpGameMode.m index f0cb469..af51a70 100644 --- a/Classes/JumpGameMode.m +++ b/Classes/JumpGameMode.m
@@ -10,6 +10,7 @@
10#import "SimpleAudioEngine.h" 10#import "SimpleAudioEngine.h"
11#import "FallingObject.h" 11#import "FallingObject.h"
12#import "GameOverScene.h" 12#import "GameOverScene.h"
13#import "ScoreBarLayer.h"
13 14
14#define kMinimumGestureLength 25 15#define kMinimumGestureLength 25
15 16
@@ -41,6 +42,8 @@
41 42
42@implementation JumpGameMode 43@implementation JumpGameMode
43 44
45@synthesize score, lives, pointMultiplier;
46
44typedef enum { 47typedef enum {
45 kRockObject = 0, 48 kRockObject = 0,
46 kOneUpObject, 49 kOneUpObject,
@@ -75,6 +78,33 @@ static GameModeInfo* info;
75 backgroundImage.position = ccp(240, 160); 78 backgroundImage.position = ccp(240, 160);
76 [self addChild:backgroundImage z:-1]; 79 [self addChild:backgroundImage z:-1];
77 80
81 score = 0;
82 lives = 3;
83 pointMultiplier = 1;
84
85 ScoreBarLayer* scoreBar = [ScoreBarLayer scoreBar];
86 [self addChild:scoreBar];
87
88 scoreLabel = [CCLabelBMFont labelWithString:@"0" fntFile:@"helvetica2.fnt"];
89 scoreLabel.position = ccp(30,20);
90 [scoreBar addChild:scoreLabel];
91
92 CCSprite* livesImage = [CCSprite spriteWithFile:@"oneup.png"];
93 livesImage.position = ccp(110, 20);
94 [scoreBar addChild:livesImage];
95
96 livesLabel = [CCLabelBMFont labelWithString:@"x3" fntFile:@"helvetica2.fnt"];
97 livesLabel.position = ccp(142,20);
98 [scoreBar addChild:livesLabel];
99
100 CCSprite* pointMultiplierImage = [CCSprite spriteWithFile:@"multiplier.png"];
101 pointMultiplierImage.position = ccp(190, 20);
102 [scoreBar addChild:pointMultiplierImage];
103
104 pointMultiplierLabel = [CCLabelBMFont labelWithString:@"x1" fntFile:@"helvetica2.fnt"];
105 pointMultiplierLabel.position = ccp(222,20);
106 [scoreBar addChild:pointMultiplierLabel];
107
78 water = [CCSprite spriteWithFile:@"water.png"]; 108 water = [CCSprite spriteWithFile:@"water.png"];
79 water.position = ccp(240, -60); 109 water.position = ccp(240, -60);
80 [self addChild:water]; 110 [self addChild:water];
@@ -491,16 +521,30 @@ static GameModeInfo* info;
491 [self setScore:self.score+pointMultiplier]; 521 [self setScore:self.score+pointMultiplier];
492} 522}
493 523
494- (void)setLives:(int)m_lives 524- (void)setScore:(int)m_score
495{ 525{
496 int oldLives = lives; 526 score = m_score;
497
498 [super setLives:m_lives];
499 527
500 if (oldLives > lives) 528 [scoreLabel setString:[NSString stringWithFormat:@"%d", score]];
529}
530
531- (void)setLives:(int)m_lives
532{
533 if (m_lives < lives)
501 { 534 {
502 [self setPointMultiplier:1]; 535 [self setPointMultiplier:1];
503 } 536 }
537
538 lives = m_lives;
539
540 [livesLabel setString:[NSString stringWithFormat:@"x%d", lives]];
541}
542
543- (void)setPointMultiplier:(int)m_pointMultiplier
544{
545 pointMultiplier = m_pointMultiplier;
546
547 [pointMultiplierLabel setString:[NSString stringWithFormat:@"x%d", pointMultiplier]];
504} 548}
505 549
506- (void)didCatchItem:(FallingObject *)item 550- (void)didCatchItem:(FallingObject *)item
diff --git a/Classes/ScoreBarLayer.h b/Classes/ScoreBarLayer.h new file mode 100644 index 0000000..4102f73 --- /dev/null +++ b/Classes/ScoreBarLayer.h
@@ -0,0 +1,19 @@
1//
2// ScoreBarLayer.h
3// Cartographic
4//
5// Created by Starla Insigna on 1/4/13.
6// Copyright 2013 __MyCompanyName__. All rights reserved.
7//
8
9#import <Foundation/Foundation.h>
10#import "cocos2d.h"
11
12@interface ScoreBarLayer : CCLayerGradient {
13
14}
15
16+ (ScoreBarLayer*)scoreBar;
17- (id)init;
18
19@end
diff --git a/Classes/ScoreBarLayer.m b/Classes/ScoreBarLayer.m new file mode 100644 index 0000000..b838ac9 --- /dev/null +++ b/Classes/ScoreBarLayer.m
@@ -0,0 +1,41 @@
1//
2// ScoreBarLayer.m
3// Cartographic
4//
5// Created by Starla Insigna on 1/4/13.
6// Copyright 2013 __MyCompanyName__. All rights reserved.
7//
8
9#import "ScoreBarLayer.h"
10
11
12@implementation ScoreBarLayer
13
14+ (ScoreBarLayer*)scoreBar
15{
16 return [[[ScoreBarLayer alloc] init] autorelease];
17}
18
19- (id)init
20{
21 self = [super initWithColor:ccc4(101, 214, 253, 255) fadingTo:ccc4(0, 104, 248, 255)];
22
23 if (nil != self)
24 {
25 [self changeWidth:480 height:40];
26 self.position = ccp(0, 280);
27 }
28
29 return self;
30}
31
32- (void)draw
33{
34 [super draw];
35
36 glEnable(GL_LINE_SMOOTH);
37 glColor4ub(0, 0, 0, 255);
38 ccDrawLine(ccp(0,0), ccp(480,0));
39}
40
41@end
diff --git a/Classes/TutorialMode.h b/Classes/TutorialMode.h index 697c688..160e6bc 100644 --- a/Classes/TutorialMode.h +++ b/Classes/TutorialMode.h
@@ -14,9 +14,16 @@
14 TutorialBubble* currentTutorial; 14 TutorialBubble* currentTutorial;
15 BOOL showedDeathBubble; 15 BOOL showedDeathBubble;
16 int randomItemsDropped; 16 int randomItemsDropped;
17
18 int score;
19 int lives;
20 CCLabelBMFont* scoreLabel;
21 CCLabelBMFont* livesLabel;
17} 22}
18 23
19@property (nonatomic,retain) TutorialBubble* currentTutorial; 24@property (nonatomic,retain) TutorialBubble* currentTutorial;
25@property (nonatomic) int score;
26@property (nonatomic) int lives;
20- (void)endTutorial; 27- (void)endTutorial;
21- (FallingObject*)dropSpecificItem:(int)objectType; 28- (FallingObject*)dropSpecificItem:(int)objectType;
22- (FallingObject*)dropRandomItem; 29- (FallingObject*)dropRandomItem;
diff --git a/Classes/TutorialMode.m b/Classes/TutorialMode.m index 3f37505..17d9412 100644 --- a/Classes/TutorialMode.m +++ b/Classes/TutorialMode.m
@@ -12,6 +12,7 @@
12#import "SimpleAudioEngine.h" 12#import "SimpleAudioEngine.h"
13#import "ClassicGameMode.h" 13#import "ClassicGameMode.h"
14#import "JumpGameMode.h" 14#import "JumpGameMode.h"
15#import "ScoreBarLayer.h"
15 16
16// Item tags: 17// Item tags:
17// 2000 - first dropped item 18// 2000 - first dropped item
@@ -30,7 +31,7 @@ typedef enum {
30 31
31@implementation TutorialMode 32@implementation TutorialMode
32 33
33@synthesize currentTutorial; 34@synthesize currentTutorial, lives, score;
34 35
35static GameModeInfo* info; 36static GameModeInfo* info;
36 37
@@ -60,9 +61,27 @@ static GameModeInfo* info;
60 backgroundImage.position = ccp(240, 160); 61 backgroundImage.position = ccp(240, 160);
61 [self addChild:backgroundImage z:-1]; 62 [self addChild:backgroundImage z:-1];
62 63
64 score = 0;
65 lives = 3;
66
63 showedDeathBubble = NO; 67 showedDeathBubble = NO;
64 randomItemsDropped = 0; 68 randomItemsDropped = 0;
65 69
70 ScoreBarLayer* scoreBar = [ScoreBarLayer scoreBar];
71 [self addChild:scoreBar];
72
73 scoreLabel = [CCLabelBMFont labelWithString:@"0" fntFile:@"helvetica2.fnt"];
74 scoreLabel.position = ccp(30,20);
75 [scoreBar addChild:scoreLabel];
76
77 CCSprite* livesImage = [CCSprite spriteWithFile:@"oneup.png"];
78 livesImage.position = ccp(110, 20);
79 [scoreBar addChild:livesImage];
80
81 livesLabel = [CCLabelBMFont labelWithString:@"x3" fntFile:@"helvetica2.fnt"];
82 livesLabel.position = ccp(142,20);
83 [scoreBar addChild:livesLabel];
84
66 [objectFactory createRecipeWithIdentifier:kCherryObject spriteFilename:@"cherry.png" weight:5]; 85 [objectFactory createRecipeWithIdentifier:kCherryObject spriteFilename:@"cherry.png" weight:5];
67 [objectFactory createRecipeWithIdentifier:kEnergyDrinkObject spriteFilename:@"bottle.png" weight:6]; 86 [objectFactory createRecipeWithIdentifier:kEnergyDrinkObject spriteFilename:@"bottle.png" weight:6];
68 [objectFactory createRecipeWithIdentifier:kOneUpObject spriteFilename:@"oneup.png" weight:10]; 87 [objectFactory createRecipeWithIdentifier:kOneUpObject spriteFilename:@"oneup.png" weight:10];
@@ -397,4 +416,19 @@ static GameModeInfo* info;
397 randomItemsDropped++; 416 randomItemsDropped++;
398} 417}
399 418
419
420- (void)setScore:(int)m_score
421{
422 score = m_score;
423
424 [scoreLabel setString:[NSString stringWithFormat:@"%d", score]];
425}
426
427- (void)setLives:(int)m_lives
428{
429 lives = m_lives;
430
431 [livesLabel setString:[NSString stringWithFormat:@"x%d", lives]];
432}
433
400@end 434@end