diff options
Diffstat (limited to 'Classes/GameMode.m')
-rw-r--r-- | Classes/GameMode.m | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Classes/GameMode.m b/Classes/GameMode.m index 8f695d1..f0eb02f 100644 --- a/Classes/GameMode.m +++ b/Classes/GameMode.m | |||
@@ -40,6 +40,7 @@ | |||
40 | cart = [[Cart alloc] initWithSprite:[CCSprite spriteWithFile:@"cart.png"]]; | 40 | cart = [[Cart alloc] initWithSprite:[CCSprite spriteWithFile:@"cart.png"]]; |
41 | cart.sprite.position = ccp(240, 22); | 41 | cart.sprite.position = ccp(240, 22); |
42 | cart.sprite.scale = 2; | 42 | cart.sprite.scale = 2; |
43 | cart.delegate = self; | ||
43 | [self addChild:cart.sprite]; | 44 | [self addChild:cart.sprite]; |
44 | 45 | ||
45 | scoreLabel = [CCLabelBMFont labelWithString:@"Score: 0" fntFile:@"helvetica2.fnt"]; | 46 | scoreLabel = [CCLabelBMFont labelWithString:@"Score: 0" fntFile:@"helvetica2.fnt"]; |
@@ -84,13 +85,16 @@ | |||
84 | { | 85 | { |
85 | [cart tick]; | 86 | [cart tick]; |
86 | 87 | ||
88 | NSMutableSet* discardedObjects = [NSMutableSet set]; | ||
87 | for (FallingObject* object in objects) | 89 | for (FallingObject* object in objects) |
88 | { | 90 | { |
89 | if ([object tick]) | 91 | if ([object tick]) |
90 | { | 92 | { |
91 | [objects removeObject:object]; | 93 | [discardedObjects addObject:object]; |
92 | } | 94 | } |
93 | } | 95 | } |
96 | |||
97 | [objects minusSet:discardedObjects]; | ||
94 | } | 98 | } |
95 | 99 | ||
96 | - (BOOL)canPause | 100 | - (BOOL)canPause |