From fee8d3506b4c2f6d5933a85181de9bb8e6f5fcc4 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Wed, 17 Aug 2011 12:54:22 -0400 Subject: Made tutorial replayable Closes #202 --- Cart Collect.xcodeproj/project.pbxproj | 18 +++++++++--------- Classes/MainMenuLayer.h | 1 + Classes/MainMenuLayer.m | 21 ++++++++++----------- Classes/TutorialMode.h | 1 - Classes/TutorialMode.m | 23 ++--------------------- Resources/skiptutorial.png | Bin 2871 -> 0 bytes Resources/skiptutorial2.png | Bin 3193 -> 0 bytes Resources/tutorial.png | Bin 0 -> 2131 bytes Resources/tutorial2.png | Bin 0 -> 2337 bytes 9 files changed, 22 insertions(+), 42 deletions(-) delete mode 100644 Resources/skiptutorial.png delete mode 100644 Resources/skiptutorial2.png create mode 100644 Resources/tutorial.png create mode 100644 Resources/tutorial2.png diff --git a/Cart Collect.xcodeproj/project.pbxproj b/Cart Collect.xcodeproj/project.pbxproj index 280cb2a..1c07ef3 100755 --- a/Cart Collect.xcodeproj/project.pbxproj +++ b/Cart Collect.xcodeproj/project.pbxproj @@ -103,11 +103,11 @@ 6C0C141413F20E98003A31B2 /* GameMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C0C141313F20E98003A31B2 /* GameMode.m */; }; 6C29041013EAEB590032DA0F /* TutorialBubble.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C29040F13EAEB590032DA0F /* TutorialBubble.m */; }; 6C29041213EAEC8A0032DA0F /* framestuff.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C29041113EAEC8A0032DA0F /* framestuff.png */; }; + 6C39CFE013FC2708002B21AF /* tutorial.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39CFDF13FC2708002B21AF /* tutorial.png */; }; + 6C39CFE213FC2713002B21AF /* tutorial2.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39CFE113FC2713002B21AF /* tutorial2.png */; }; 6C5179C613DF3839006F1F38 /* Morning1.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C5179C513DF3839006F1F38 /* Morning1.png */; }; 6CC89DD913F2F4E6003704F7 /* Entitlements.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6CC89DD813F2F4E6003704F7 /* Entitlements.plist */; }; 6CC89DDF13F31413003704F7 /* TutorialMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CC89DDE13F31413003704F7 /* TutorialMode.m */; }; - 6CF29FF013F5580400C83428 /* skiptutorial.png in Resources */ = {isa = PBXBuildFile; fileRef = 6CF29FEE13F5580400C83428 /* skiptutorial.png */; }; - 6CF29FF113F5580400C83428 /* skiptutorial2.png in Resources */ = {isa = PBXBuildFile; fileRef = 6CF29FEF13F5580400C83428 /* skiptutorial2.png */; }; DC6640030F83B3EA000B3E49 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC6640020F83B3EA000B3E49 /* AudioToolbox.framework */; }; DC6640050F83B3EA000B3E49 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC6640040F83B3EA000B3E49 /* OpenAL.framework */; }; DCCBF1B70F6022AE0040855A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCCBF1B60F6022AE0040855A /* CoreGraphics.framework */; }; @@ -342,7 +342,7 @@ 3F6C7EE013D636BE00C038FE /* rock.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = rock.png; sourceTree = ""; }; 3F6C7EE213D636CF00C038FE /* Rock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Rock.h; sourceTree = ""; }; 3F6C7EE313D636CF00C038FE /* Rock.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Rock.m; sourceTree = ""; }; - 3F6C7EE713D6377D00C038FE /* GameOverScene.h */ = {isa = PBXFileReference; fileEncoding = 4; path = GameOverScene.h; sourceTree = ""; }; + 3F6C7EE713D6377D00C038FE /* GameOverScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameOverScene.h; sourceTree = ""; }; 3F6C7EE813D6377D00C038FE /* GameOverScene.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameOverScene.m; sourceTree = ""; }; 3F6C7F2313D63E6500C038FE /* SeaBeach.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = SeaBeach.png; sourceTree = ""; }; 3F6C7F4A13D647A600C038FE /* GameOver.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = GameOver.png; sourceTree = ""; }; @@ -409,13 +409,13 @@ 6C29040E13EAEB590032DA0F /* TutorialBubble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TutorialBubble.h; sourceTree = ""; }; 6C29040F13EAEB590032DA0F /* TutorialBubble.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TutorialBubble.m; sourceTree = ""; }; 6C29041113EAEC8A0032DA0F /* framestuff.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = framestuff.png; sourceTree = ""; }; + 6C39CFDF13FC2708002B21AF /* tutorial.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tutorial.png; sourceTree = ""; }; + 6C39CFE113FC2713002B21AF /* tutorial2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tutorial2.png; sourceTree = ""; }; 6C5179C513DF3839006F1F38 /* Morning1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Morning1.png; sourceTree = ""; }; 6CC89DD813F2F4E6003704F7 /* Entitlements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Entitlements.plist; sourceTree = ""; }; 6CC89DDD13F31413003704F7 /* TutorialMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TutorialMode.h; sourceTree = ""; }; 6CC89DDE13F31413003704F7 /* TutorialMode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TutorialMode.m; sourceTree = ""; }; 6CC89DE013F3197F003704F7 /* FallingObjectDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FallingObjectDelegate.h; sourceTree = ""; }; - 6CF29FEE13F5580400C83428 /* skiptutorial.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = skiptutorial.png; sourceTree = ""; }; - 6CF29FEF13F5580400C83428 /* skiptutorial2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = skiptutorial2.png; sourceTree = ""; }; DC6640020F83B3EA000B3E49 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; DC6640040F83B3EA000B3E49 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; DCCBF1B60F6022AE0040855A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; @@ -765,8 +765,8 @@ 3F7D0EC713D8E6B000B6CE14 /* Buttons */ = { isa = PBXGroup; children = ( - 6CF29FEE13F5580400C83428 /* skiptutorial.png */, - 6CF29FEF13F5580400C83428 /* skiptutorial2.png */, + 6C39CFE113FC2713002B21AF /* tutorial2.png */, + 6C39CFDF13FC2708002B21AF /* tutorial.png */, 3F7D0F4813D8F17C00B6CE14 /* highscores.png */, 3F7D0F4913D8F17C00B6CE14 /* highscores2.png */, 3F7D0F4A13D8F17C00B6CE14 /* newgame.png */, @@ -1361,8 +1361,8 @@ 6C5179C613DF3839006F1F38 /* Morning1.png in Resources */, 6C29041213EAEC8A0032DA0F /* framestuff.png in Resources */, 6CC89DD913F2F4E6003704F7 /* Entitlements.plist in Resources */, - 6CF29FF013F5580400C83428 /* skiptutorial.png in Resources */, - 6CF29FF113F5580400C83428 /* skiptutorial2.png in Resources */, + 6C39CFE013FC2708002B21AF /* tutorial.png in Resources */, + 6C39CFE213FC2713002B21AF /* tutorial2.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; 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 @@ + (CCScene*)scene; - (id)init; - (void)newgame; +- (void)tutorial; - (void)highscores; @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 @@ //CCLabelBMFont* menuItemLabel2 = [CCLabelBMFont labelWithString:@"Highscores" fntFile:@"getoffthatboatrightnowyounglady.fnt"]; //CCMenuItemLabel* menuItem2 = [CCMenuItemLabel itemWithLabel:menuItemLabel2 target:self selector:@selector(highscores)]; - CCMenuItemImage* menuItem1 = [CCMenuItemImage itemFromNormalImage:@"newgame.png" selectedImage:@"newgame2.png" target:self selector:@selector(newgame)]; - CCMenuItemImage* menuItem2 = [CCMenuItemImage itemFromNormalImage:@"highscores.png" selectedImage:@"highscores2.png" target:self selector:@selector(highscores)]; + CCMenuItemImage* newgameMenuItem = [CCMenuItemImage itemFromNormalImage:@"newgame.png" selectedImage:@"newgame2.png" target:self selector:@selector(newgame)]; + CCMenuItemImage* tutorialMenuItem = [CCMenuItemImage itemFromNormalImage:@"tutorial.png" selectedImage:@"tutorial2.png" target:self selector:@selector(tutorial)]; + CCMenuItemImage* highscoresMenuItem = [CCMenuItemImage itemFromNormalImage:@"highscores.png" selectedImage:@"highscores2.png" target:self selector:@selector(highscores)]; - CCMenu* menu = [CCMenu menuWithItems:menuItem1, menuItem2, nil]; + CCMenu* menu = [CCMenu menuWithItems:newgameMenuItem, tutorialMenuItem, highscoresMenuItem, nil]; [menu alignItemsVertically]; menu.position = ccp(240, 100); [self addChild:menu]; @@ -58,14 +59,12 @@ - (void)newgame { - NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; - - if ([defaults boolForKey:@"hasDoneTutorial"]) - { - [[CCDirector sharedDirector] replaceScene:[ClassicGameMode scene]]; - } else { - [[CCDirector sharedDirector] replaceScene:[TutorialMode scene]]; - } + [[CCDirector sharedDirector] replaceScene:[ClassicGameMode scene]]; +} + +- (void)tutorial +{ + [[CCDirector sharedDirector] replaceScene:[TutorialMode scene]]; } - (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 @@ - (FallingObject*)dropSpecificItem:(FallingObject*)item; - (FallingObject*)dropRandomItem; - (void)randomlyAddObject:(ccTime)dt; -- (void)skipTutorial; @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 @@ #import "Bottle.h" #import "OneUp.h" #import "Rock.h" -#import "ClassicGameMode.h" +#import "MainMenuLayer.h" // Item tags: // 2000 - first dropped item @@ -35,11 +35,6 @@ backgroundImage.position = ccp(240, 160); [self addChild:backgroundImage z:-1]; - CCMenuItemImage* menuItem1 = [CCMenuItemImage itemFromNormalImage:@"skiptutorial.png" selectedImage:@"skiptutorial2.png" target:self selector:@selector(skipTutorial)]; - CCMenu* theMenu = [CCMenu menuWithItems:menuItem1, nil]; - theMenu.position = ccp(480-16-16-62, 320-8-16); - [self addChild:theMenu]; - showedDeathBubble = NO; randomItemsDropped = 0; } @@ -201,10 +196,7 @@ [self schedule:@selector(randomlyAddObject:) interval:1.0f]; } else if ([currentTutorial.name isEqual:@"end"]) { - NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; - [defaults setBool:YES forKey:@"hasDoneTutorial"]; - - [[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:3.0f scene:[ClassicGameMode scene] withColor:ccc3(0,0,0)]]; + [[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:3.0f scene:[MainMenuLayer scene] withColor:ccc3(0,0,0)]]; } self.currentTutorial = nil; @@ -335,15 +327,4 @@ randomItemsDropped++; } -- (void)skipTutorial -{ - [self unscheduleAllSelectors]; - self.currentTutorial = nil; - - NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; - [defaults setBool:YES forKey:@"hasDoneTutorial"]; - - [[CCDirector sharedDirector] replaceScene:[CCTransitionFlipY transitionWithDuration:1.0f scene:[ClassicGameMode scene]]]; -} - @end diff --git a/Resources/skiptutorial.png b/Resources/skiptutorial.png deleted file mode 100644 index 5c95cc9..0000000 Binary files a/Resources/skiptutorial.png and /dev/null differ diff --git a/Resources/skiptutorial2.png b/Resources/skiptutorial2.png deleted file mode 100644 index 95bbbbd..0000000 Binary files a/Resources/skiptutorial2.png and /dev/null differ diff --git a/Resources/tutorial.png b/Resources/tutorial.png new file mode 100644 index 0000000..a82a5e4 Binary files /dev/null and b/Resources/tutorial.png differ diff --git a/Resources/tutorial2.png b/Resources/tutorial2.png new file mode 100644 index 0000000..d5b3271 Binary files /dev/null and b/Resources/tutorial2.png differ -- cgit 1.4.1