diff options
Diffstat (limited to 'Classes/TutorialMode.m')
-rw-r--r-- | Classes/TutorialMode.m | 36 |
1 files changed, 35 insertions, 1 deletions
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 | ||
35 | static GameModeInfo* info; | 36 | static 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 |