diff options
author | Starla Insigna <starla4444@gmail.com> | 2011-08-17 12:54:22 -0400 |
---|---|---|
committer | Starla Insigna <starla4444@gmail.com> | 2011-08-17 12:54:22 -0400 |
commit | fee8d3506b4c2f6d5933a85181de9bb8e6f5fcc4 (patch) | |
tree | 6b45cb1d47551ab0cbcd4d45a919212db6a6aaed /Classes | |
parent | c55c499656ed089df63b049979487e9af9d109d6 (diff) | |
download | cartcollect-fee8d3506b4c2f6d5933a85181de9bb8e6f5fcc4.tar.gz cartcollect-fee8d3506b4c2f6d5933a85181de9bb8e6f5fcc4.tar.bz2 cartcollect-fee8d3506b4c2f6d5933a85181de9bb8e6f5fcc4.zip |
Made tutorial replayable
Closes #202
Diffstat (limited to 'Classes')
-rwxr-xr-x | Classes/MainMenuLayer.h | 1 | ||||
-rwxr-xr-x | Classes/MainMenuLayer.m | 21 | ||||
-rw-r--r-- | Classes/TutorialMode.h | 1 | ||||
-rw-r--r-- | Classes/TutorialMode.m | 23 |
4 files changed, 13 insertions, 33 deletions
diff --git a/Classes/MainMenuLayer.h b/Classes/MainMenuLayer.h index d8483b3..e43c5e1 100755 --- a/Classes/MainMenuLayer.h +++ b/Classes/MainMenuLayer.h | |||
@@ -16,6 +16,7 @@ | |||
16 | + (CCScene*)scene; | 16 | + (CCScene*)scene; |
17 | - (id)init; | 17 | - (id)init; |
18 | - (void)newgame; | 18 | - (void)newgame; |
19 | - (void)tutorial; | ||
19 | - (void)highscores; | 20 | - (void)highscores; |
20 | 21 | ||
21 | @end | 22 | @end |
diff --git a/Classes/MainMenuLayer.m b/Classes/MainMenuLayer.m index 50c595f..537c5c1 100755 --- a/Classes/MainMenuLayer.m +++ b/Classes/MainMenuLayer.m | |||
@@ -44,10 +44,11 @@ | |||
44 | //CCLabelBMFont* menuItemLabel2 = [CCLabelBMFont labelWithString:@"Highscores" fntFile:@"getoffthatboatrightnowyounglady.fnt"]; | 44 | //CCLabelBMFont* menuItemLabel2 = [CCLabelBMFont labelWithString:@"Highscores" fntFile:@"getoffthatboatrightnowyounglady.fnt"]; |
45 | //CCMenuItemLabel* menuItem2 = [CCMenuItemLabel itemWithLabel:menuItemLabel2 target:self selector:@selector(highscores)]; | 45 | //CCMenuItemLabel* menuItem2 = [CCMenuItemLabel itemWithLabel:menuItemLabel2 target:self selector:@selector(highscores)]; |
46 | 46 | ||
47 | CCMenuItemImage* menuItem1 = [CCMenuItemImage itemFromNormalImage:@"newgame.png" selectedImage:@"newgame2.png" target:self selector:@selector(newgame)]; | 47 | CCMenuItemImage* newgameMenuItem = [CCMenuItemImage itemFromNormalImage:@"newgame.png" selectedImage:@"newgame2.png" target:self selector:@selector(newgame)]; |
48 | CCMenuItemImage* menuItem2 = [CCMenuItemImage itemFromNormalImage:@"highscores.png" selectedImage:@"highscores2.png" target:self selector:@selector(highscores)]; | 48 | CCMenuItemImage* tutorialMenuItem = [CCMenuItemImage itemFromNormalImage:@"tutorial.png" selectedImage:@"tutorial2.png" target:self selector:@selector(tutorial)]; |
49 | CCMenuItemImage* highscoresMenuItem = [CCMenuItemImage itemFromNormalImage:@"highscores.png" selectedImage:@"highscores2.png" target:self selector:@selector(highscores)]; | ||
49 | 50 | ||
50 | CCMenu* menu = [CCMenu menuWithItems:menuItem1, menuItem2, nil]; | 51 | CCMenu* menu = [CCMenu menuWithItems:newgameMenuItem, tutorialMenuItem, highscoresMenuItem, nil]; |
51 | [menu alignItemsVertically]; | 52 | [menu alignItemsVertically]; |
52 | menu.position = ccp(240, 100); | 53 | menu.position = ccp(240, 100); |
53 | [self addChild:menu]; | 54 | [self addChild:menu]; |
@@ -58,14 +59,12 @@ | |||
58 | 59 | ||
59 | - (void)newgame | 60 | - (void)newgame |
60 | { | 61 | { |
61 | NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | 62 | [[CCDirector sharedDirector] replaceScene:[ClassicGameMode scene]]; |
62 | 63 | } | |
63 | if ([defaults boolForKey:@"hasDoneTutorial"]) | 64 | |
64 | { | 65 | - (void)tutorial |
65 | [[CCDirector sharedDirector] replaceScene:[ClassicGameMode scene]]; | 66 | { |
66 | } else { | 67 | [[CCDirector sharedDirector] replaceScene:[TutorialMode scene]]; |
67 | [[CCDirector sharedDirector] replaceScene:[TutorialMode scene]]; | ||
68 | } | ||
69 | } | 68 | } |
70 | 69 | ||
71 | - (void)highscores | 70 | - (void)highscores |
diff --git a/Classes/TutorialMode.h b/Classes/TutorialMode.h index 17b0c7f..6380483 100644 --- a/Classes/TutorialMode.h +++ b/Classes/TutorialMode.h | |||
@@ -21,6 +21,5 @@ | |||
21 | - (FallingObject*)dropSpecificItem:(FallingObject*)item; | 21 | - (FallingObject*)dropSpecificItem:(FallingObject*)item; |
22 | - (FallingObject*)dropRandomItem; | 22 | - (FallingObject*)dropRandomItem; |
23 | - (void)randomlyAddObject:(ccTime)dt; | 23 | - (void)randomlyAddObject:(ccTime)dt; |
24 | - (void)skipTutorial; | ||
25 | 24 | ||
26 | @end | 25 | @end |
diff --git a/Classes/TutorialMode.m b/Classes/TutorialMode.m index 37e8bd0..ed51648 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 "ClassicGameMode.h" | 15 | #import "MainMenuLayer.h" |
16 | 16 | ||
17 | // Item tags: | 17 | // Item tags: |
18 | // 2000 - first dropped item | 18 | // 2000 - first dropped item |
@@ -35,11 +35,6 @@ | |||
35 | backgroundImage.position = ccp(240, 160); | 35 | backgroundImage.position = ccp(240, 160); |
36 | [self addChild:backgroundImage z:-1]; | 36 | [self addChild:backgroundImage z:-1]; |
37 | 37 | ||
38 | CCMenuItemImage* menuItem1 = [CCMenuItemImage itemFromNormalImage:@"skiptutorial.png" selectedImage:@"skiptutorial2.png" target:self selector:@selector(skipTutorial)]; | ||
39 | CCMenu* theMenu = [CCMenu menuWithItems:menuItem1, nil]; | ||
40 | theMenu.position = ccp(480-16-16-62, 320-8-16); | ||
41 | [self addChild:theMenu]; | ||
42 | |||
43 | showedDeathBubble = NO; | 38 | showedDeathBubble = NO; |
44 | randomItemsDropped = 0; | 39 | randomItemsDropped = 0; |
45 | } | 40 | } |
@@ -201,10 +196,7 @@ | |||
201 | [self schedule:@selector(randomlyAddObject:) interval:1.0f]; | 196 | [self schedule:@selector(randomlyAddObject:) interval:1.0f]; |
202 | } else if ([currentTutorial.name isEqual:@"end"]) | 197 | } else if ([currentTutorial.name isEqual:@"end"]) |
203 | { | 198 | { |
204 | NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | 199 | [[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:3.0f scene:[MainMenuLayer scene] withColor:ccc3(0,0,0)]]; |
205 | [defaults setBool:YES forKey:@"hasDoneTutorial"]; | ||
206 | |||
207 | [[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:3.0f scene:[ClassicGameMode scene] withColor:ccc3(0,0,0)]]; | ||
208 | } | 200 | } |
209 | 201 | ||
210 | self.currentTutorial = nil; | 202 | self.currentTutorial = nil; |
@@ -335,15 +327,4 @@ | |||
335 | randomItemsDropped++; | 327 | randomItemsDropped++; |
336 | } | 328 | } |
337 | 329 | ||
338 | - (void)skipTutorial | ||
339 | { | ||
340 | [self unscheduleAllSelectors]; | ||
341 | self.currentTutorial = nil; | ||
342 | |||
343 | NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | ||
344 | [defaults setBool:YES forKey:@"hasDoneTutorial"]; | ||
345 | |||
346 | [[CCDirector sharedDirector] replaceScene:[CCTransitionFlipY transitionWithDuration:1.0f scene:[ClassicGameMode scene]]]; | ||
347 | } | ||
348 | |||
349 | @end | 330 | @end |