summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStarla Insigna <starla4444@gmail.com>2011-09-10 10:04:18 -0400
committerStarla Insigna <starla4444@gmail.com>2011-09-10 10:04:18 -0400
commitab9f7381455b334fa0df563e21775410be74ea45 (patch)
tree531ffb35abf20c8a75103a66c7de0a7136b11d24
parentb090d12d637e5cfbf0ac6955fa6c8d401de657b5 (diff)
downloadcartcollect-ab9f7381455b334fa0df563e21775410be74ea45.tar.gz
cartcollect-ab9f7381455b334fa0df563e21775410be74ea45.tar.bz2
cartcollect-ab9f7381455b334fa0df563e21775410be74ea45.zip
Added point multipliers
There is support for point multipliers for any game mode, but only Jump currently utilizes it.

Closes #222
-rwxr-xr-xCartographic.xcodeproj/project.pbxproj10
-rw-r--r--Classes/GameMode.h2
-rw-r--r--Classes/GameMode.m22
-rw-r--r--Classes/JumpGameMode.m46
-rw-r--r--Classes/PointMultiplier.h15
-rw-r--r--Classes/PointMultiplier.m36
-rwxr-xr-xResources/multiplier.pngbin0 -> 1131 bytes
7 files changed, 108 insertions, 23 deletions
diff --git a/Cartographic.xcodeproj/project.pbxproj b/Cartographic.xcodeproj/project.pbxproj index 8fd0d47..1a41374 100755 --- a/Cartographic.xcodeproj/project.pbxproj +++ b/Cartographic.xcodeproj/project.pbxproj
@@ -129,6 +129,8 @@
129 6CC89DD913F2F4E6003704F7 /* Entitlements.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6CC89DD813F2F4E6003704F7 /* Entitlements.plist */; }; 129 6CC89DD913F2F4E6003704F7 /* Entitlements.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6CC89DD813F2F4E6003704F7 /* Entitlements.plist */; };
130 6CC89DDF13F31413003704F7 /* TutorialMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CC89DDE13F31413003704F7 /* TutorialMode.m */; }; 130 6CC89DDF13F31413003704F7 /* TutorialMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CC89DDE13F31413003704F7 /* TutorialMode.m */; };
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 */; };
133 6CF64C0B141BA37000F3B702 /* multiplier.png in Resources */ = {isa = PBXBuildFile; fileRef = 6CF64C0A141BA37000F3B702 /* multiplier.png */; };
132 DC6640030F83B3EA000B3E49 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC6640020F83B3EA000B3E49 /* AudioToolbox.framework */; }; 134 DC6640030F83B3EA000B3E49 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC6640020F83B3EA000B3E49 /* AudioToolbox.framework */; };
133 DC6640050F83B3EA000B3E49 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC6640040F83B3EA000B3E49 /* OpenAL.framework */; }; 135 DC6640050F83B3EA000B3E49 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC6640040F83B3EA000B3E49 /* OpenAL.framework */; };
134 DCCBF1B70F6022AE0040855A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCCBF1B60F6022AE0040855A /* CoreGraphics.framework */; }; 136 DCCBF1B70F6022AE0040855A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCCBF1B60F6022AE0040855A /* CoreGraphics.framework */; };
@@ -471,6 +473,9 @@
471 6CC89DE013F3197F003704F7 /* FallingObjectDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FallingObjectDelegate.h; sourceTree = "<group>"; }; 473 6CC89DE013F3197F003704F7 /* FallingObjectDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FallingObjectDelegate.h; sourceTree = "<group>"; };
472 6CDBE80B14092DB00072F287 /* ledge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ledge.png; sourceTree = "<group>"; }; 474 6CDBE80B14092DB00072F287 /* ledge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ledge.png; sourceTree = "<group>"; };
473 6CDBE80E140936CF0072F287 /* CartDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CartDelegate.h; sourceTree = "<group>"; }; 475 6CDBE80E140936CF0072F287 /* CartDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CartDelegate.h; sourceTree = "<group>"; };
476 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 6CF64C0A141BA37000F3B702 /* multiplier.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = multiplier.png; sourceTree = "<group>"; };
474 DC6640020F83B3EA000B3E49 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 479 DC6640020F83B3EA000B3E49 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
475 DC6640040F83B3EA000B3E49 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; 480 DC6640040F83B3EA000B3E49 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; };
476 DCCBF1B60F6022AE0040855A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 481 DCCBF1B60F6022AE0040855A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
@@ -788,6 +793,7 @@
788 3F6C7F4D13D647B600C038FE /* Sprites */ = { 793 3F6C7F4D13D647B600C038FE /* Sprites */ = {
789 isa = PBXGroup; 794 isa = PBXGroup;
790 children = ( 795 children = (
796 6CF64C0A141BA37000F3B702 /* multiplier.png */,
791 6CDBE80B14092DB00072F287 /* ledge.png */, 797 6CDBE80B14092DB00072F287 /* ledge.png */,
792 6C39CFE613FC46CD002B21AF /* water.png */, 798 6C39CFE613FC46CD002B21AF /* water.png */,
793 6C29041113EAEC8A0032DA0F /* framestuff.png */, 799 6C29041113EAEC8A0032DA0F /* framestuff.png */,
@@ -973,6 +979,8 @@
973 6C0C141013F2099B003A31B2 /* Cart.m */, 979 6C0C141013F2099B003A31B2 /* Cart.m */,
974 6CC89DE013F3197F003704F7 /* FallingObjectDelegate.h */, 980 6CC89DE013F3197F003704F7 /* FallingObjectDelegate.h */,
975 6CDBE80E140936CF0072F287 /* CartDelegate.h */, 981 6CDBE80E140936CF0072F287 /* CartDelegate.h */,
982 6CF64C07141B9FA300F3B702 /* PointMultiplier.h */,
983 6CF64C08141B9FA300F3B702 /* PointMultiplier.m */,
976 ); 984 );
977 name = Items; 985 name = Items;
978 sourceTree = "<group>"; 986 sourceTree = "<group>";
@@ -1479,6 +1487,7 @@
1479 6C39CFEB13FC8ACA002B21AF /* jump.png in Resources */, 1487 6C39CFEB13FC8ACA002B21AF /* jump.png in Resources */,
1480 6C85834614056E57009EF100 /* venice.png in Resources */, 1488 6C85834614056E57009EF100 /* venice.png in Resources */,
1481 6CDBE80C14092DB00072F287 /* ledge.png in Resources */, 1489 6CDBE80C14092DB00072F287 /* ledge.png in Resources */,
1490 6CF64C0B141BA37000F3B702 /* multiplier.png in Resources */,
1482 ); 1491 );
1483 runOnlyForDeploymentPostprocessing = 0; 1492 runOnlyForDeploymentPostprocessing = 0;
1484 }; 1493 };
@@ -1533,6 +1542,7 @@
1533 6C85834014055A44009EF100 /* CCNotifications.m in Sources */, 1542 6C85834014055A44009EF100 /* CCNotifications.m in Sources */,
1534 6C85834414055B2E009EF100 /* notificationDesign.m in Sources */, 1543 6C85834414055B2E009EF100 /* notificationDesign.m in Sources */,
1535 6C4400041415080800A9E1D7 /* ZoomFadeTransition.m in Sources */, 1544 6C4400041415080800A9E1D7 /* ZoomFadeTransition.m in Sources */,
1545 6CF64C09141B9FA300F3B702 /* PointMultiplier.m in Sources */,
1536 ); 1546 );
1537 runOnlyForDeploymentPostprocessing = 0; 1547 runOnlyForDeploymentPostprocessing = 0;
1538 }; 1548 };
diff --git a/Classes/GameMode.h b/Classes/GameMode.h index 0659a57..e82ad10 100644 --- a/Classes/GameMode.h +++ b/Classes/GameMode.h
@@ -16,6 +16,7 @@
16 NSMutableSet* objects; 16 NSMutableSet* objects;
17 int score; 17 int score;
18 int lives; 18 int lives;
19 int pointMultiplier;
19 Cart* cart; 20 Cart* cart;
20 21
21 CCLayerColor* shadedLayer; 22 CCLayerColor* shadedLayer;
@@ -32,6 +33,7 @@
32@property (readonly) Cart* cart; 33@property (readonly) Cart* cart;
33@property (nonatomic,assign) int score; 34@property (nonatomic,assign) int score;
34@property (nonatomic,assign) int lives; 35@property (nonatomic,assign) int lives;
36@property (nonatomic,assign) int pointMultiplier;
35@property (readonly) BOOL isPaused; 37@property (readonly) BOOL isPaused;
36+ (CCScene*)scene; 38+ (CCScene*)scene;
37- (void)tick:(ccTime)dt; 39- (void)tick:(ccTime)dt;
diff --git a/Classes/GameMode.m b/Classes/GameMode.m index f0eb02f..1e80237 100644 --- a/Classes/GameMode.m +++ b/Classes/GameMode.m
@@ -12,7 +12,7 @@
12 12
13@implementation GameMode 13@implementation GameMode
14 14
15@synthesize cart, score, lives, isPaused; 15@synthesize cart, score, lives, isPaused, pointMultiplier;
16 16
17+ (CCScene*)scene 17+ (CCScene*)scene
18{ 18{
@@ -53,6 +53,7 @@
53 53
54 score = 0; 54 score = 0;
55 lives = 3; 55 lives = 3;
56 pointMultiplier = 1;
56 57
57 if ([self canPause]) 58 if ([self canPause])
58 { 59 {
@@ -159,7 +160,12 @@
159{ 160{
160 score = m_score; 161 score = m_score;
161 162
162 [scoreLabel setString:[NSString stringWithFormat:@"Score: %d", score]]; 163 if (pointMultiplier > 1)
164 {
165 [scoreLabel setString:[NSString stringWithFormat:@"Score: %d x%d", score, pointMultiplier]];
166 } else {
167 [scoreLabel setString:[NSString stringWithFormat:@"Score: %d", score]];
168 }
163} 169}
164 170
165- (void)setLives:(int)m_lives 171- (void)setLives:(int)m_lives
@@ -169,6 +175,18 @@
169 [livesLabel setString:[NSString stringWithFormat:@"Lives: %d", lives]]; 175 [livesLabel setString:[NSString stringWithFormat:@"Lives: %d", lives]];
170} 176}
171 177
178- (void)setPointMultiplier:(int)m_pointMultiplier
179{
180 pointMultiplier = m_pointMultiplier;
181
182 if (pointMultiplier > 1)
183 {
184 [scoreLabel setString:[NSString stringWithFormat:@"Score: %d x%d", score, pointMultiplier]];
185 } else {
186 [scoreLabel setString:[NSString stringWithFormat:@"Score: %d", score]];
187 }
188}
189
172- (void)scheduleDelayedAction:(void(^)(void))m_delayedAction delay:(float)delay 190- (void)scheduleDelayedAction:(void(^)(void))m_delayedAction delay:(float)delay
173{ 191{
174 delayedAction = Block_copy([m_delayedAction retain]); 192 delayedAction = Block_copy([m_delayedAction retain]);
diff --git a/Classes/JumpGameMode.m b/Classes/JumpGameMode.m index 0cf916a..9076426 100644 --- a/Classes/JumpGameMode.m +++ b/Classes/JumpGameMode.m
@@ -14,6 +14,7 @@
14#import "OneUp.h" 14#import "OneUp.h"
15#import "Rock.h" 15#import "Rock.h"
16#import "GameOverScene.h" 16#import "GameOverScene.h"
17#import "PointMultiplier.h"
17 18
18#define kMinimumGestureLength 25 19#define kMinimumGestureLength 25
19 20
@@ -308,26 +309,17 @@
308{ 309{
309 FallingObject* object; 310 FallingObject* object;
310 311
311 if (score < 120) 312 int randomval = arc4random()%100;
312 { 313
313 int randomval = arc4random()%100; 314 if (randomval < 50)
314 315 {
315 if (randomval < 80) 316 object = [[Rock alloc] init];
316 { 317 } else if (randomval < 75)
317 object = [[Rock alloc] init]; 318 {
318 } else { 319 object = [[PointMultiplier alloc] init];
319 object = [[OneUp alloc] init]; 320 } else {
320 } 321 object = [[OneUp alloc] init];
321 } else { 322 }
322 int randomval = arc4random()%100;
323
324 if (randomval < 70)
325 {
326 object = [[Rock alloc] init];
327 } else {
328 object = [[OneUp alloc] init];
329 }
330 }
331 323
332 int objectX; 324 int objectX;
333 325
@@ -434,7 +426,19 @@
434 426
435- (void)incrementScore 427- (void)incrementScore
436{ 428{
437 [self setScore:self.score+1]; 429 [self setScore:self.score+pointMultiplier];
430}
431
432- (void)setLives:(int)m_lives
433{
434 int oldLives = lives;
435
436 [super setLives:m_lives];
437
438 if (oldLives > lives)
439 {
440 [self setPointMultiplier:1];
441 }
438} 442}
439 443
440@end 444@end
diff --git a/Classes/PointMultiplier.h b/Classes/PointMultiplier.h new file mode 100644 index 0000000..9d009cb --- /dev/null +++ b/Classes/PointMultiplier.h
@@ -0,0 +1,15 @@
1//
2// PointMultiplier.h
3// Cartographic
4//
5// Created by Starla Insigna on 9/10/11.
6// Copyright (c) 2011 Four Island. All rights reserved.
7//
8
9#import "FallingObject.h"
10
11@interface PointMultiplier : FallingObject
12
13- (id)init;
14
15@end
diff --git a/Classes/PointMultiplier.m b/Classes/PointMultiplier.m new file mode 100644 index 0000000..a14bf68 --- /dev/null +++ b/Classes/PointMultiplier.m
@@ -0,0 +1,36 @@
1//
2// PointMultiplier.m
3// Cartographic
4//
5// Created by Starla Insigna on 9/10/11.
6// Copyright (c) 2011 Four Island. All rights reserved.
7//
8
9#import "PointMultiplier.h"
10#import "GameMode.h"
11#import "SimpleAudioEngine.h"
12
13@implementation PointMultiplier
14
15- (id)init
16{
17 self = [super init];
18
19 if (nil != self)
20 {
21 sprite = [CCSprite spriteWithFile:@"multiplier.png"];
22 weight = 8;
23 }
24
25 return self;
26}
27
28- (void)collideWithCart
29{
30 GameMode* gameLayer = ((GameMode*) sprite.parent);
31 [gameLayer setPointMultiplier:gameLayer.pointMultiplier+1];
32
33 [[SimpleAudioEngine sharedEngine] playEffect:[[NSBundle mainBundle] pathForResource:@"Item1" ofType:@"wav"]];
34}
35
36@end
diff --git a/Resources/multiplier.png b/Resources/multiplier.png new file mode 100755 index 0000000..94f5719 --- /dev/null +++ b/Resources/multiplier.png
Binary files differ