summary refs log tree commit diff stats
path: root/Classes/TutorialMode.m
diff options
context:
space:
mode:
Diffstat (limited to 'Classes/TutorialMode.m')
-rw-r--r--Classes/TutorialMode.m58
1 files changed, 39 insertions, 19 deletions
diff --git a/Classes/TutorialMode.m b/Classes/TutorialMode.m index ed51648..3c70a46 100644 --- a/Classes/TutorialMode.m +++ b/Classes/TutorialMode.m
@@ -12,7 +12,7 @@
12#import "Bottle.h" 12#import "Bottle.h"
13#import "OneUp.h" 13#import "OneUp.h"
14#import "Rock.h" 14#import "Rock.h"
15#import "MainMenuLayer.h" 15#import "GameModeSelectionLayer.h"
16 16
17// Item tags: 17// Item tags:
18// 2000 - first dropped item 18// 2000 - first dropped item
@@ -20,6 +20,7 @@
20// 2002 - items that are dropped after you miss first dropped item to demonstrate what happens when you catch 20// 2002 - items that are dropped after you miss first dropped item to demonstrate what happens when you catch
21// 2003 - 1-Up 21// 2003 - 1-Up
22// 2009 - rock 22// 2009 - rock
23// 2010 - random item dropped after death from first rock
23 24
24@implementation TutorialMode 25@implementation TutorialMode
25 26
@@ -47,7 +48,7 @@
47 [super onEnterTransitionDidFinish]; 48 [super onEnterTransitionDidFinish];
48 49
49 [self scheduleDelayedAction:^{ 50 [self scheduleDelayedAction:^{
50 TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"Welcome to Cart Collect. This is a tutorial designed to help you get started playing the game. Below this bubble is a cart. Tilt your device to move it." name:@"cart" spriteReference:cart.sprite]; 51 TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"Welcome to Cartographic. This is a tutorial designed to help you get started playing the game. Below this bubble is a cart. Tilt your device to move it." name:@"cart" spriteReference:cart.sprite];
51 self.currentTutorial = bubble; 52 self.currentTutorial = bubble;
52 [bubble release]; 53 [bubble release];
53 } delay:2.0f]; 54 } delay:2.0f];
@@ -122,7 +123,30 @@
122 [self schedule:@selector(randomlyAddObject:) interval:2.5f]; 123 [self schedule:@selector(randomlyAddObject:) interval:2.5f];
123 } else if (item.sprite.tag == 2009) 124 } else if (item.sprite.tag == 2009)
124 { 125 {
125 TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"As you play, Cart Collect gets progressively more intense. Watch what happens when rocks are added to the mix and the speed is turned up." name:@"intense"]; 126 if ((lives < 1) && (!showedDeathBubble))
127 {
128 showedDeathBubble = YES;
129
130 TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"You lost all your lives! Normally, you'd be taken to a game over screen where you could submit your score to the highscore list, but we're a bit more forgiving in tutorial mode." name:@"gameover-rock"];
131 self.currentTutorial = bubble;
132 [bubble release];
133 } else {
134 TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"As you play, Cartographic gets progressively more intense. Watch what happens when rocks are added to the mix and the speed is turned up." name:@"intense"];
135 self.currentTutorial = bubble;
136 [bubble release];
137 }
138 } else if (item.sprite.tag == 2010)
139 {
140 TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"As you play, Cartographic gets progressively more intense. Watch what happens when rocks are added to the mix and the speed is turned up." name:@"intense"];
141 self.currentTutorial = bubble;
142 [bubble release];
143 }
144
145 if ((lives < 1) && (!showedDeathBubble))
146 {
147 showedDeathBubble = YES;
148
149 TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"You lost all your lives! Normally, you'd be taken to a game over screen where you could submit your score to the highscore list, but we're a bit more forgiving in tutorial mode." name:@"gameover"];
126 self.currentTutorial = bubble; 150 self.currentTutorial = bubble;
127 [bubble release]; 151 [bubble release];
128 } 152 }
@@ -191,12 +215,19 @@
191 object.sprite.tag = 2003; 215 object.sprite.tag = 2003;
192 [object release]; 216 [object release];
193 } delay:2.0f]; 217 } delay:2.0f];
218 } else if ([currentTutorial.name isEqual:@"gameover-rock"])
219 {
220 [self scheduleDelayedAction:^{
221 FallingObject* object = [self dropRandomItem];
222 object.sprite.tag = 2010;
223 [object release];
224 } delay:1.0f];
194 } else if ([currentTutorial.name isEqual:@"intense"]) 225 } else if ([currentTutorial.name isEqual:@"intense"])
195 { 226 {
196 [self schedule:@selector(randomlyAddObject:) interval:1.0f]; 227 [self schedule:@selector(randomlyAddObject:) interval:1.0f];
197 } else if ([currentTutorial.name isEqual:@"end"]) 228 } else if ([currentTutorial.name isEqual:@"end"])
198 { 229 {
199 [[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:3.0f scene:[MainMenuLayer scene] withColor:ccc3(0,0,0)]]; 230 [[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:3.0f scene:[GameModeSelectionLayer scene] withColor:ccc3(0,0,0)]];
200 } 231 }
201 232
202 self.currentTutorial = nil; 233 self.currentTutorial = nil;
@@ -252,20 +283,6 @@
252 return [self dropSpecificItem:object]; 283 return [self dropSpecificItem:object];
253} 284}
254 285
255- (void)setLives:(int)m_lives
256{
257 [super setLives:m_lives];
258
259 if ((lives < 1) && (!showedDeathBubble))
260 {
261 showedDeathBubble = YES;
262
263 TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"You lost all your lives! Normally, you'd be taken to a game over screen where you could submit your score to the highscore list, but we're a bit more forgiving in tutorial mode." name:@"gameover"];
264 self.currentTutorial = bubble;
265 [bubble release];
266 }
267}
268
269- (void)randomlyAddObject:(ccTime)dt 286- (void)randomlyAddObject:(ccTime)dt
270{ 287{
271 FallingObject* object; 288 FallingObject* object;
@@ -307,13 +324,16 @@
307 } else if (randomItemsDropped == 15) 324 } else if (randomItemsDropped == 15)
308 { 325 {
309 [self scheduleDelayedAction:^{ 326 [self scheduleDelayedAction:^{
310 TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"That's pretty much it! You've completed the tutorial, so now it's time to play an actual game of Cart Collect!" name:@"end"]; 327 TutorialBubble* bubble = [[TutorialBubble alloc] initWithText:@"That's pretty much it! You've completed the tutorial, so now it's time to play an actual game of Cartographic!" name:@"end"];
311 self.currentTutorial = bubble; 328 self.currentTutorial = bubble;
312 [bubble release]; 329 [bubble release];
313 } delay:2.0f]; 330 } delay:2.0f];
314 331
315 [self unschedule:@selector(randomlyAddObject:)]; 332 [self unschedule:@selector(randomlyAddObject:)];
316 333
334 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
335 [defaults setBool:YES forKey:@"hasDoneTutorial"];
336
317 return; 337 return;
318 } else { 338 } else {
319 NSLog(@"randomItemsDropped in TutorialMode is greater than 15--this should never happen."); 339 NSLog(@"randomItemsDropped in TutorialMode is greater than 15--this should never happen.");