summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStarla Insigna <starla4444@gmail.com>2011-08-17 19:54:25 -0400
committerStarla Insigna <starla4444@gmail.com>2011-08-17 19:54:25 -0400
commit4d94802036a53e6ec246ab0abac17fd76d17c885 (patch)
tree7e19df50363755707b7e7907117888146abc2377
parentfee8d3506b4c2f6d5933a85181de9bb8e6f5fcc4 (diff)
downloadcartcollect-4d94802036a53e6ec246ab0abac17fd76d17c885.tar.gz
cartcollect-4d94802036a53e6ec246ab0abac17fd76d17c885.tar.bz2
cartcollect-4d94802036a53e6ec246ab0abac17fd76d17c885.zip
Started Jump game mode
So far, Jump exists as a blank world where the player can control the cart (including the ability to jump by swiping upwards) and where the water level rises for a bit and then falls, taking the cart with it.

Refs #204
-rwxr-xr-xCart Collect.xcodeproj/project.pbxproj18
-rw-r--r--Classes/JumpGameMode.h21
-rw-r--r--Classes/JumpGameMode.m110
-rwxr-xr-xClasses/MainMenuLayer.h1
-rwxr-xr-xClasses/MainMenuLayer.m9
-rw-r--r--Resources/jump.pngbin0 -> 2071 bytes
-rw-r--r--Resources/jump2.pngbin0 -> 2079 bytes
-rw-r--r--Resources/water.pngbin0 -> 981 bytes
8 files changed, 158 insertions, 1 deletions
diff --git a/Cart Collect.xcodeproj/project.pbxproj b/Cart Collect.xcodeproj/project.pbxproj index 1c07ef3..5ecda95 100755 --- a/Cart Collect.xcodeproj/project.pbxproj +++ b/Cart Collect.xcodeproj/project.pbxproj
@@ -105,6 +105,10 @@
105 6C29041213EAEC8A0032DA0F /* framestuff.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C29041113EAEC8A0032DA0F /* framestuff.png */; }; 105 6C29041213EAEC8A0032DA0F /* framestuff.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C29041113EAEC8A0032DA0F /* framestuff.png */; };
106 6C39CFE013FC2708002B21AF /* tutorial.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39CFDF13FC2708002B21AF /* tutorial.png */; }; 106 6C39CFE013FC2708002B21AF /* tutorial.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39CFDF13FC2708002B21AF /* tutorial.png */; };
107 6C39CFE213FC2713002B21AF /* tutorial2.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39CFE113FC2713002B21AF /* tutorial2.png */; }; 107 6C39CFE213FC2713002B21AF /* tutorial2.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39CFE113FC2713002B21AF /* tutorial2.png */; };
108 6C39CFE513FC4635002B21AF /* JumpGameMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C39CFE413FC4635002B21AF /* JumpGameMode.m */; };
109 6C39CFE713FC46CD002B21AF /* water.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39CFE613FC46CD002B21AF /* water.png */; };
110 6C39CFE913FC8AC4002B21AF /* jump2.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39CFE813FC8AC4002B21AF /* jump2.png */; };
111 6C39CFEB13FC8ACA002B21AF /* jump.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39CFEA13FC8ACA002B21AF /* jump.png */; };
108 6C5179C613DF3839006F1F38 /* Morning1.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C5179C513DF3839006F1F38 /* Morning1.png */; }; 112 6C5179C613DF3839006F1F38 /* Morning1.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C5179C513DF3839006F1F38 /* Morning1.png */; };
109 6CC89DD913F2F4E6003704F7 /* Entitlements.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6CC89DD813F2F4E6003704F7 /* Entitlements.plist */; }; 113 6CC89DD913F2F4E6003704F7 /* Entitlements.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6CC89DD813F2F4E6003704F7 /* Entitlements.plist */; };
110 6CC89DDF13F31413003704F7 /* TutorialMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CC89DDE13F31413003704F7 /* TutorialMode.m */; }; 114 6CC89DDF13F31413003704F7 /* TutorialMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CC89DDE13F31413003704F7 /* TutorialMode.m */; };
@@ -411,6 +415,11 @@
411 6C29041113EAEC8A0032DA0F /* framestuff.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = framestuff.png; sourceTree = "<group>"; }; 415 6C29041113EAEC8A0032DA0F /* framestuff.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = framestuff.png; sourceTree = "<group>"; };
412 6C39CFDF13FC2708002B21AF /* tutorial.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tutorial.png; sourceTree = "<group>"; }; 416 6C39CFDF13FC2708002B21AF /* tutorial.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tutorial.png; sourceTree = "<group>"; };
413 6C39CFE113FC2713002B21AF /* tutorial2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tutorial2.png; sourceTree = "<group>"; }; 417 6C39CFE113FC2713002B21AF /* tutorial2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tutorial2.png; sourceTree = "<group>"; };
418 6C39CFE313FC4635002B21AF /* JumpGameMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JumpGameMode.h; sourceTree = "<group>"; };
419 6C39CFE413FC4635002B21AF /* JumpGameMode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JumpGameMode.m; sourceTree = "<group>"; };
420 6C39CFE613FC46CD002B21AF /* water.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = water.png; sourceTree = "<group>"; };
421 6C39CFE813FC8AC4002B21AF /* jump2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = jump2.png; sourceTree = "<group>"; };
422 6C39CFEA13FC8ACA002B21AF /* jump.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = jump.png; sourceTree = "<group>"; };
414 6C5179C513DF3839006F1F38 /* Morning1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Morning1.png; sourceTree = "<group>"; }; 423 6C5179C513DF3839006F1F38 /* Morning1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Morning1.png; sourceTree = "<group>"; };
415 6CC89DD813F2F4E6003704F7 /* Entitlements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Entitlements.plist; sourceTree = "<group>"; }; 424 6CC89DD813F2F4E6003704F7 /* Entitlements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Entitlements.plist; sourceTree = "<group>"; };
416 6CC89DDD13F31413003704F7 /* TutorialMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TutorialMode.h; sourceTree = "<group>"; }; 425 6CC89DDD13F31413003704F7 /* TutorialMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TutorialMode.h; sourceTree = "<group>"; };
@@ -729,6 +738,7 @@
729 3F6C7F4D13D647B600C038FE /* Sprites */ = { 738 3F6C7F4D13D647B600C038FE /* Sprites */ = {
730 isa = PBXGroup; 739 isa = PBXGroup;
731 children = ( 740 children = (
741 6C39CFE613FC46CD002B21AF /* water.png */,
732 6C29041113EAEC8A0032DA0F /* framestuff.png */, 742 6C29041113EAEC8A0032DA0F /* framestuff.png */,
733 3F6C7EE013D636BE00C038FE /* rock.png */, 743 3F6C7EE013D636BE00C038FE /* rock.png */,
734 3F63FA3E13D4EE53003B3D14 /* oneup.png */, 744 3F63FA3E13D4EE53003B3D14 /* oneup.png */,
@@ -765,6 +775,8 @@
765 3F7D0EC713D8E6B000B6CE14 /* Buttons */ = { 775 3F7D0EC713D8E6B000B6CE14 /* Buttons */ = {
766 isa = PBXGroup; 776 isa = PBXGroup;
767 children = ( 777 children = (
778 6C39CFEA13FC8ACA002B21AF /* jump.png */,
779 6C39CFE813FC8AC4002B21AF /* jump2.png */,
768 6C39CFE113FC2713002B21AF /* tutorial2.png */, 780 6C39CFE113FC2713002B21AF /* tutorial2.png */,
769 6C39CFDF13FC2708002B21AF /* tutorial.png */, 781 6C39CFDF13FC2708002B21AF /* tutorial.png */,
770 3F7D0F4813D8F17C00B6CE14 /* highscores.png */, 782 3F7D0F4813D8F17C00B6CE14 /* highscores.png */,
@@ -871,6 +883,8 @@
871 3FE79CD313D4DE37001A6B93 /* ClassicGameMode.m */, 883 3FE79CD313D4DE37001A6B93 /* ClassicGameMode.m */,
872 6CC89DDD13F31413003704F7 /* TutorialMode.h */, 884 6CC89DDD13F31413003704F7 /* TutorialMode.h */,
873 6CC89DDE13F31413003704F7 /* TutorialMode.m */, 885 6CC89DDE13F31413003704F7 /* TutorialMode.m */,
886 6C39CFE313FC4635002B21AF /* JumpGameMode.h */,
887 6C39CFE413FC4635002B21AF /* JumpGameMode.m */,
874 ); 888 );
875 name = "Game Modes"; 889 name = "Game Modes";
876 sourceTree = "<group>"; 890 sourceTree = "<group>";
@@ -1363,6 +1377,9 @@
1363 6CC89DD913F2F4E6003704F7 /* Entitlements.plist in Resources */, 1377 6CC89DD913F2F4E6003704F7 /* Entitlements.plist in Resources */,
1364 6C39CFE013FC2708002B21AF /* tutorial.png in Resources */, 1378 6C39CFE013FC2708002B21AF /* tutorial.png in Resources */,
1365 6C39CFE213FC2713002B21AF /* tutorial2.png in Resources */, 1379 6C39CFE213FC2713002B21AF /* tutorial2.png in Resources */,
1380 6C39CFE713FC46CD002B21AF /* water.png in Resources */,
1381 6C39CFE913FC8AC4002B21AF /* jump2.png in Resources */,
1382 6C39CFEB13FC8ACA002B21AF /* jump.png in Resources */,
1366 ); 1383 );
1367 runOnlyForDeploymentPostprocessing = 0; 1384 runOnlyForDeploymentPostprocessing = 0;
1368 }; 1385 };
@@ -1407,6 +1424,7 @@
1407 6C0C141113F2099B003A31B2 /* Cart.m in Sources */, 1424 6C0C141113F2099B003A31B2 /* Cart.m in Sources */,
1408 6C0C141413F20E98003A31B2 /* GameMode.m in Sources */, 1425 6C0C141413F20E98003A31B2 /* GameMode.m in Sources */,
1409 6CC89DDF13F31413003704F7 /* TutorialMode.m in Sources */, 1426 6CC89DDF13F31413003704F7 /* TutorialMode.m in Sources */,
1427 6C39CFE513FC4635002B21AF /* JumpGameMode.m in Sources */,
1410 ); 1428 );
1411 runOnlyForDeploymentPostprocessing = 0; 1429 runOnlyForDeploymentPostprocessing = 0;
1412 }; 1430 };
diff --git a/Classes/JumpGameMode.h b/Classes/JumpGameMode.h new file mode 100644 index 0000000..7b7dff4 --- /dev/null +++ b/Classes/JumpGameMode.h
@@ -0,0 +1,21 @@
1//
2// JumpGameMode.h
3// Cart Collect
4//
5// Created by Starla Insigna on 8/17/11.
6// Copyright 2011 Four Island. All rights reserved.
7//
8
9#import "GameMode.h"
10
11@interface JumpGameMode : GameMode <CCStandardTouchDelegate> {
12 CCSprite* water;
13 int waterTick;
14 BOOL wave;
15 CGPoint gestureStartPoint;
16 int jumpTick;
17 BOOL jump;
18 float swipeVarianceModifer;
19}
20
21@end
diff --git a/Classes/JumpGameMode.m b/Classes/JumpGameMode.m new file mode 100644 index 0000000..e8c8c7e --- /dev/null +++ b/Classes/JumpGameMode.m
@@ -0,0 +1,110 @@
1//
2// JumpGameMode.m
3// Cart Collect
4//
5// Created by Starla Insigna on 8/17/11.
6// Copyright 2011 Four Island. All rights reserved.
7//
8
9#import "JumpGameMode.h"
10
11#define kMinimumGestureLength 25
12#define kMaximumVariance 5
13
14@implementation JumpGameMode
15
16- (id)init
17{
18 self = [super init];
19
20 if (nil != self)
21 {
22 water = [CCSprite spriteWithFile:@"water.png"];
23 water.position = ccp(240, -80);
24 [self addChild:water];
25
26 self.isTouchEnabled = YES;
27
28 waterTick = 0;
29 wave = NO;
30 }
31
32 return self;
33}
34
35- (void)onEnterTransitionDidFinish
36{
37 [super onEnterTransitionDidFinish];
38
39 [self scheduleDelayedAction:^{
40 wave = YES;
41 } delay:3.0f];
42}
43
44- (void)tick:(ccTime)dt
45{
46 [super tick:dt];
47
48 if (wave)
49 {
50 waterTick++;
51
52 water.position = ccp(240, 160 * sin(waterTick / (36 * M_PI)) - 80);
53
54 if (waterTick == 180)
55 {
56 wave = NO;
57
58 [self scheduleDelayedAction:^{
59 wave = YES;
60 } delay:10.0f];
61 } else if (waterTick == 360)
62 {
63 wave = NO;
64 waterTick = 0;
65 }
66 }
67
68 if (jump)
69 {
70 jumpTick++;
71
72 cart.sprite.position = ccp(cart.sprite.position.x, MAX(100 * sin(jumpTick / (2 * M_PI)) + 22, water.position.y+80+11));
73
74 if (jumpTick == 20)
75 {
76 jump = NO;
77 jumpTick = 0;
78 }
79 } else {
80 cart.sprite.position = ccp(cart.sprite.position.x, MAX(22, water.position.y+80+11));
81 }
82}
83
84- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
85{
86 UITouch* touch = [touches anyObject];
87 gestureStartPoint = [touch locationInView:nil];
88}
89
90- (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
91{
92 UITouch* touch = [touches anyObject];
93 CGPoint gestureCurrentPosition = [touch locationInView:nil];
94 CGFloat deltaX = fabsf(gestureStartPoint.x - gestureCurrentPosition.x);
95 CGFloat deltaY = fabsf(gestureStartPoint.y - gestureCurrentPosition.y);
96
97 if ((deltaX >= kMinimumGestureLength) && (deltaY <= kMaximumVariance*swipeVarianceModifer) && (cart.sprite.position.y == 22))
98 {
99 jump = YES;
100 }
101}
102
103- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
104{
105 [super accelerometer:accelerometer didAccelerate:acceleration];
106
107 swipeVarianceModifer = MAX(1,(fabsf(acceleration.y) * 480)/kMaximumVariance);
108}
109
110@end
diff --git a/Classes/MainMenuLayer.h b/Classes/MainMenuLayer.h index e43c5e1..c7e3348 100755 --- a/Classes/MainMenuLayer.h +++ b/Classes/MainMenuLayer.h
@@ -17,6 +17,7 @@
17- (id)init; 17- (id)init;
18- (void)newgame; 18- (void)newgame;
19- (void)tutorial; 19- (void)tutorial;
20- (void)jump;
20- (void)highscores; 21- (void)highscores;
21 22
22@end 23@end
diff --git a/Classes/MainMenuLayer.m b/Classes/MainMenuLayer.m index 537c5c1..cf4b8cf 100755 --- a/Classes/MainMenuLayer.m +++ b/Classes/MainMenuLayer.m
@@ -11,6 +11,7 @@
11#import "ClassicGameMode.h" 11#import "ClassicGameMode.h"
12#import "TutorialMode.h" 12#import "TutorialMode.h"
13#import "Cart_CollectAppDelegate.h" 13#import "Cart_CollectAppDelegate.h"
14#import "JumpGameMode.h"
14 15
15@implementation MainMenuLayer 16@implementation MainMenuLayer
16 17
@@ -46,9 +47,10 @@
46 47
47 CCMenuItemImage* newgameMenuItem = [CCMenuItemImage itemFromNormalImage:@"newgame.png" selectedImage:@"newgame2.png" target:self selector:@selector(newgame)]; 48 CCMenuItemImage* newgameMenuItem = [CCMenuItemImage itemFromNormalImage:@"newgame.png" selectedImage:@"newgame2.png" target:self selector:@selector(newgame)];
48 CCMenuItemImage* tutorialMenuItem = [CCMenuItemImage itemFromNormalImage:@"tutorial.png" selectedImage:@"tutorial2.png" target:self selector:@selector(tutorial)]; 49 CCMenuItemImage* tutorialMenuItem = [CCMenuItemImage itemFromNormalImage:@"tutorial.png" selectedImage:@"tutorial2.png" target:self selector:@selector(tutorial)];
50 CCMenuItemImage* jumpMenuItem = [CCMenuItemImage itemFromNormalImage:@"jump.png" selectedImage:@"jump2.png" target:self selector:@selector(jump)];
49 CCMenuItemImage* highscoresMenuItem = [CCMenuItemImage itemFromNormalImage:@"highscores.png" selectedImage:@"highscores2.png" target:self selector:@selector(highscores)]; 51 CCMenuItemImage* highscoresMenuItem = [CCMenuItemImage itemFromNormalImage:@"highscores.png" selectedImage:@"highscores2.png" target:self selector:@selector(highscores)];
50 52
51 CCMenu* menu = [CCMenu menuWithItems:newgameMenuItem, tutorialMenuItem, highscoresMenuItem, nil]; 53 CCMenu* menu = [CCMenu menuWithItems:newgameMenuItem, tutorialMenuItem, jumpMenuItem, highscoresMenuItem, nil];
52 [menu alignItemsVertically]; 54 [menu alignItemsVertically];
53 menu.position = ccp(240, 100); 55 menu.position = ccp(240, 100);
54 [self addChild:menu]; 56 [self addChild:menu];
@@ -67,6 +69,11 @@
67 [[CCDirector sharedDirector] replaceScene:[TutorialMode scene]]; 69 [[CCDirector sharedDirector] replaceScene:[TutorialMode scene]];
68} 70}
69 71
72- (void)jump
73{
74 [[CCDirector sharedDirector] replaceScene:[JumpGameMode scene]];
75}
76
70- (void)highscores 77- (void)highscores
71{ 78{
72 HighscoreListController* listController = [[HighscoreListController alloc] initWithStyle:UITableViewStylePlain]; 79 HighscoreListController* listController = [[HighscoreListController alloc] initWithStyle:UITableViewStylePlain];
diff --git a/Resources/jump.png b/Resources/jump.png new file mode 100644 index 0000000..4546088 --- /dev/null +++ b/Resources/jump.png
Binary files differ
diff --git a/Resources/jump2.png b/Resources/jump2.png new file mode 100644 index 0000000..3e83046 --- /dev/null +++ b/Resources/jump2.png
Binary files differ
diff --git a/Resources/water.png b/Resources/water.png new file mode 100644 index 0000000..bf4ff13 --- /dev/null +++ b/Resources/water.png
Binary files differ