summary refs log tree commit diff stats
path: root/Classes/ValuableObject.m
diff options
context:
space:
mode:
Diffstat (limited to 'Classes/ValuableObject.m')
-rw-r--r--Classes/ValuableObject.m46
1 files changed, 46 insertions, 0 deletions
diff --git a/Classes/ValuableObject.m b/Classes/ValuableObject.m new file mode 100644 index 0000000..f1a036f --- /dev/null +++ b/Classes/ValuableObject.m
@@ -0,0 +1,46 @@
1//
2// ValuableObject.m
3// Cart Collect
4//
5// Created by Starla Insigna on 8/9/11.
6// Copyright 2011 Four Island. All rights reserved.
7//
8
9#import "ValuableObject.h"
10#import "GameMode.h"
11#import "SimpleAudioEngine.h"
12
13@implementation ValuableObject
14
15- (id)init
16{
17 self = [super init];
18 if (self) {
19 // Initialization code here.
20 }
21
22 return self;
23}
24
25- (void)collideWithCart
26{
27 GameMode* gameLayer = ((GameMode*) sprite.parent);
28 [gameLayer setScore:gameLayer.score+self.pointValue];
29
30 [[SimpleAudioEngine sharedEngine] playEffect:[[NSBundle mainBundle] pathForResource:@"Item1" ofType:@"wav"]];
31}
32
33- (void)collideWithFloor
34{
35 GameMode* gameLayer = ((GameMode*) sprite.parent);
36 [gameLayer setLives:gameLayer.lives-1];
37
38 [[SimpleAudioEngine sharedEngine] playEffect:[[NSBundle mainBundle] pathForResource:@"Damage1" ofType:@"wav"]];
39}
40
41- (int)pointValue
42{
43 @throw [NSException exceptionWithName:NSInternalInconsistencyException reason:[NSString stringWithFormat:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)] userInfo:nil];
44}
45
46@end