diff options
author | Starla Insigna <starla4444@gmail.com> | 2011-09-10 10:25:25 -0400 |
---|---|---|
committer | Starla Insigna <starla4444@gmail.com> | 2011-09-10 10:25:25 -0400 |
commit | c5edc8808e9f9dbb1daeda760ba74ef0cf2e9dce (patch) | |
tree | 07a4064c546cab9a130a3f3b13c762c190f9749a | |
parent | ab9f7381455b334fa0df563e21775410be74ea45 (diff) | |
download | cartcollect-e9ccb80c81f8926dafa09690da5bd2c4d13e3ec5.tar.gz cartcollect-e9ccb80c81f8926dafa09690da5bd2c4d13e3ec5.tar.bz2 cartcollect-e9ccb80c81f8926dafa09690da5bd2c4d13e3ec5.zip |
Modified behavior of falling objects in Jump v0.4.5
Also increased the distance between ledges as the game goes on, and changed the sound point multipliers make when you catch them. Closes #221, #223
-rwxr-xr-x | Cartographic.xcodeproj/project.pbxproj | 4 | ||||
-rwxr-xr-x | Classes/FallingObject.h | 3 | ||||
-rwxr-xr-x | Classes/FallingObject.m | 10 | ||||
-rw-r--r-- | Classes/JumpGameMode.m | 37 | ||||
-rw-r--r-- | Classes/PointMultiplier.m | 2 | ||||
-rwxr-xr-x | Resources/Absorption2.wav | bin | 0 -> 51044 bytes |
6 files changed, 53 insertions, 3 deletions
diff --git a/Cartographic.xcodeproj/project.pbxproj b/Cartographic.xcodeproj/project.pbxproj index 1a41374..75343b3 100755 --- a/Cartographic.xcodeproj/project.pbxproj +++ b/Cartographic.xcodeproj/project.pbxproj | |||
@@ -131,6 +131,7 @@ | |||
131 | 6CDBE80C14092DB00072F287 /* ledge.png in Resources */ = {isa = PBXBuildFile; fileRef = 6CDBE80B14092DB00072F287 /* ledge.png */; }; | 131 | 6CDBE80C14092DB00072F287 /* ledge.png in Resources */ = {isa = PBXBuildFile; fileRef = 6CDBE80B14092DB00072F287 /* ledge.png */; }; |
132 | 6CF64C09141B9FA300F3B702 /* PointMultiplier.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CF64C08141B9FA300F3B702 /* PointMultiplier.m */; }; | 132 | 6CF64C09141B9FA300F3B702 /* PointMultiplier.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CF64C08141B9FA300F3B702 /* PointMultiplier.m */; }; |
133 | 6CF64C0B141BA37000F3B702 /* multiplier.png in Resources */ = {isa = PBXBuildFile; fileRef = 6CF64C0A141BA37000F3B702 /* multiplier.png */; }; | 133 | 6CF64C0B141BA37000F3B702 /* multiplier.png in Resources */ = {isa = PBXBuildFile; fileRef = 6CF64C0A141BA37000F3B702 /* multiplier.png */; }; |
134 | 6CF64C11141BA84200F3B702 /* Absorption2.wav in Resources */ = {isa = PBXBuildFile; fileRef = 6CF64C10141BA84200F3B702 /* Absorption2.wav */; }; | ||
134 | DC6640030F83B3EA000B3E49 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC6640020F83B3EA000B3E49 /* AudioToolbox.framework */; }; | 135 | DC6640030F83B3EA000B3E49 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC6640020F83B3EA000B3E49 /* AudioToolbox.framework */; }; |
135 | DC6640050F83B3EA000B3E49 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC6640040F83B3EA000B3E49 /* OpenAL.framework */; }; | 136 | DC6640050F83B3EA000B3E49 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC6640040F83B3EA000B3E49 /* OpenAL.framework */; }; |
136 | DCCBF1B70F6022AE0040855A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCCBF1B60F6022AE0040855A /* CoreGraphics.framework */; }; | 137 | DCCBF1B70F6022AE0040855A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCCBF1B60F6022AE0040855A /* CoreGraphics.framework */; }; |
@@ -476,6 +477,7 @@ | |||
476 | 6CF64C07141B9FA300F3B702 /* PointMultiplier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PointMultiplier.h; sourceTree = "<group>"; }; | 477 | 6CF64C07141B9FA300F3B702 /* PointMultiplier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PointMultiplier.h; sourceTree = "<group>"; }; |
477 | 6CF64C08141B9FA300F3B702 /* PointMultiplier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PointMultiplier.m; sourceTree = "<group>"; }; | 478 | 6CF64C08141B9FA300F3B702 /* PointMultiplier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PointMultiplier.m; sourceTree = "<group>"; }; |
478 | 6CF64C0A141BA37000F3B702 /* multiplier.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = multiplier.png; sourceTree = "<group>"; }; | 479 | 6CF64C0A141BA37000F3B702 /* multiplier.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = multiplier.png; sourceTree = "<group>"; }; |
480 | 6CF64C10141BA84200F3B702 /* Absorption2.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = Absorption2.wav; sourceTree = "<group>"; }; | ||
479 | DC6640020F83B3EA000B3E49 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; | 481 | DC6640020F83B3EA000B3E49 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; |
480 | DC6640040F83B3EA000B3E49 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; | 482 | DC6640040F83B3EA000B3E49 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; |
481 | DCCBF1B60F6022AE0040855A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; | 483 | DCCBF1B60F6022AE0040855A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; |
@@ -809,6 +811,7 @@ | |||
809 | 3F6C7F4E13D647C500C038FE /* Sounds */ = { | 811 | 3F6C7F4E13D647C500C038FE /* Sounds */ = { |
810 | isa = PBXGroup; | 812 | isa = PBXGroup; |
811 | children = ( | 813 | children = ( |
814 | 6CF64C10141BA84200F3B702 /* Absorption2.wav */, | ||
812 | 3F6C7EC513D6335A00C038FE /* 1up.wav */, | 815 | 3F6C7EC513D6335A00C038FE /* 1up.wav */, |
813 | 3F6C7C4813D5DEDB00C038FE /* Item1.wav */, | 816 | 3F6C7C4813D5DEDB00C038FE /* Item1.wav */, |
814 | 3F6C7C3313D5DEB100C038FE /* Damage1.wav */, | 817 | 3F6C7C3313D5DEB100C038FE /* Damage1.wav */, |
@@ -1488,6 +1491,7 @@ | |||
1488 | 6C85834614056E57009EF100 /* venice.png in Resources */, | 1491 | 6C85834614056E57009EF100 /* venice.png in Resources */, |
1489 | 6CDBE80C14092DB00072F287 /* ledge.png in Resources */, | 1492 | 6CDBE80C14092DB00072F287 /* ledge.png in Resources */, |
1490 | 6CF64C0B141BA37000F3B702 /* multiplier.png in Resources */, | 1493 | 6CF64C0B141BA37000F3B702 /* multiplier.png in Resources */, |
1494 | 6CF64C11141BA84200F3B702 /* Absorption2.wav in Resources */, | ||
1491 | ); | 1495 | ); |
1492 | runOnlyForDeploymentPostprocessing = 0; | 1496 | runOnlyForDeploymentPostprocessing = 0; |
1493 | }; | 1497 | }; |
diff --git a/Classes/FallingObject.h b/Classes/FallingObject.h index 3e28903..d3ac638 100755 --- a/Classes/FallingObject.h +++ b/Classes/FallingObject.h | |||
@@ -14,6 +14,7 @@ | |||
14 | CCSprite* sprite; | 14 | CCSprite* sprite; |
15 | int weight; | 15 | int weight; |
16 | id<FallingObjectDelegate> delegate; | 16 | id<FallingObjectDelegate> delegate; |
17 | BOOL flags[4]; | ||
17 | } | 18 | } |
18 | 19 | ||
19 | @property (readonly) CCSprite* sprite; | 20 | @property (readonly) CCSprite* sprite; |
@@ -23,5 +24,7 @@ | |||
23 | - (BOOL)tick; | 24 | - (BOOL)tick; |
24 | - (void)collideWithCart; | 25 | - (void)collideWithCart; |
25 | - (void)collideWithFloor; | 26 | - (void)collideWithFloor; |
27 | - (BOOL)flag:(int)flag; | ||
28 | - (void)setFlag:(int)flag withValue:(BOOL)value; | ||
26 | 29 | ||
27 | @end | 30 | @end |
diff --git a/Classes/FallingObject.m b/Classes/FallingObject.m index 85ea902..86edd15 100755 --- a/Classes/FallingObject.m +++ b/Classes/FallingObject.m | |||
@@ -93,6 +93,16 @@ | |||
93 | 93 | ||
94 | } | 94 | } |
95 | 95 | ||
96 | - (BOOL)flag:(int)flag | ||
97 | { | ||
98 | return flags[flag]; | ||
99 | } | ||
100 | |||
101 | - (void)setFlag:(int)flag withValue:(BOOL)value | ||
102 | { | ||
103 | flags[flag] = value; | ||
104 | } | ||
105 | |||
96 | - (void)dealloc | 106 | - (void)dealloc |
97 | { | 107 | { |
98 | [sprite.parent removeChild:sprite cleanup:YES]; | 108 | [sprite.parent removeChild:sprite cleanup:YES]; |
diff --git a/Classes/JumpGameMode.m b/Classes/JumpGameMode.m index 9076426..14cd365 100644 --- a/Classes/JumpGameMode.m +++ b/Classes/JumpGameMode.m | |||
@@ -30,6 +30,8 @@ | |||
30 | 30 | ||
31 | @end | 31 | @end |
32 | 32 | ||
33 | // FallingObject flag 0 is whether the object is floating in water | ||
34 | |||
33 | @implementation JumpGameMode | 35 | @implementation JumpGameMode |
34 | 36 | ||
35 | - (id)init | 37 | - (id)init |
@@ -116,24 +118,55 @@ | |||
116 | } | 118 | } |
117 | } | 119 | } |
118 | 120 | ||
121 | NSMutableSet* discardedObjects = [NSMutableSet set]; | ||
119 | for (FallingObject* object in objects) | 122 | for (FallingObject* object in objects) |
120 | { | 123 | { |
121 | if (waterTick > 0) | 124 | if ((object.sprite.position.y < 86) && (![object flag:0])) |
125 | { | ||
126 | for (CCSprite* ledge in ledges) | ||
127 | { | ||
128 | CGSize first = [object.sprite boundingBox].size; | ||
129 | CGSize second = [ledge boundingBox].size; | ||
130 | |||
131 | if (object.sprite.position.x > (ledge.position.x - second.width/2 - first.width/2)) | ||
132 | { | ||
133 | if (object.sprite.position.x < (ledge.position.x + second.width/2 + first.width/2)) | ||
134 | { | ||
135 | if (object.sprite.position.y > (ledge.position.y - second.height/2 - first.height/2)) | ||
136 | { | ||
137 | if (object.sprite.position.y < (ledge.position.y + second.height/2 + first.height/2)) | ||
138 | { | ||
139 | [discardedObjects addObject:object]; | ||
140 | } | ||
141 | } | ||
142 | } | ||
143 | } | ||
144 | } | ||
145 | } | ||
146 | |||
147 | if ((waterTick >= 180) || ([object flag:0])) | ||
122 | { | 148 | { |
123 | object.sprite.position = ccp(object.sprite.position.x, MAX(object.sprite.position.y, water.position.y+80+11)); | 149 | object.sprite.position = ccp(object.sprite.position.x, MAX(object.sprite.position.y, water.position.y+80+11)); |
124 | } else { | 150 | } else { |
125 | object.sprite.position = ccp(object.sprite.position.x-ledgeScrollSpeed, object.sprite.position.y); | 151 | object.sprite.position = ccp(object.sprite.position.x-ledgeScrollSpeed, object.sprite.position.y); |
126 | } | 152 | } |
153 | |||
154 | if ((waterTick > 0) && (object.sprite.position.y <= (water.position.y+80+11))) | ||
155 | { | ||
156 | [object setFlag:0 withValue:YES]; | ||
157 | } | ||
127 | } | 158 | } |
128 | 159 | ||
129 | [ledges minusSet:discardedSet]; | 160 | [ledges minusSet:discardedSet]; |
161 | [objects minusSet:discardedObjects]; | ||
130 | 162 | ||
131 | if (rightmost <= 480) | 163 | if (rightmost <= 480) |
132 | { | 164 | { |
133 | int ledgeWidth = arc4random() % 9 + 1; | 165 | int ledgeWidth = arc4random() % 9 + 1; |
166 | int ledgeDistance = arc4random() % (ledgeScrollSpeed*ledgeScrollSpeed+1)*3/2; | ||
134 | CCTexture2D* texture = [[CCTexture2D alloc] initWithImage:[factory createLedgeWithWidth:ledgeWidth height:2]]; | 167 | CCTexture2D* texture = [[CCTexture2D alloc] initWithImage:[factory createLedgeWithWidth:ledgeWidth height:2]]; |
135 | CCSprite* ledge = [CCSprite spriteWithTexture:texture]; | 168 | CCSprite* ledge = [CCSprite spriteWithTexture:texture]; |
136 | ledge.position = ccp(rightmost + rightwidth + ledge.boundingBox.size.width/2+64, 32); | 169 | ledge.position = ccp(rightmost + rightwidth + ledge.boundingBox.size.width/2+64+ledgeDistance, 32); |
137 | [self addChild:ledge]; | 170 | [self addChild:ledge]; |
138 | [ledges addObject:ledge]; | 171 | [ledges addObject:ledge]; |
139 | [texture release]; | 172 | [texture release]; |
diff --git a/Classes/PointMultiplier.m b/Classes/PointMultiplier.m index a14bf68..0a9649d 100644 --- a/Classes/PointMultiplier.m +++ b/Classes/PointMultiplier.m | |||
@@ -30,7 +30,7 @@ | |||
30 | GameMode* gameLayer = ((GameMode*) sprite.parent); | 30 | GameMode* gameLayer = ((GameMode*) sprite.parent); |
31 | [gameLayer setPointMultiplier:gameLayer.pointMultiplier+1]; | 31 | [gameLayer setPointMultiplier:gameLayer.pointMultiplier+1]; |
32 | 32 | ||
33 | [[SimpleAudioEngine sharedEngine] playEffect:[[NSBundle mainBundle] pathForResource:@"Item1" ofType:@"wav"]]; | 33 | [[SimpleAudioEngine sharedEngine] playEffect:[[NSBundle mainBundle] pathForResource:@"Absorption2" ofType:@"wav"]]; |
34 | } | 34 | } |
35 | 35 | ||
36 | @end | 36 | @end |
diff --git a/Resources/Absorption2.wav b/Resources/Absorption2.wav new file mode 100755 index 0000000..d508ab4 --- /dev/null +++ b/Resources/Absorption2.wav | |||
Binary files differ | |||