summary refs log tree commit diff stats
path: root/Classes/FallingObject.m
diff options
context:
space:
mode:
Diffstat (limited to 'Classes/FallingObject.m')
-rwxr-xr-xClasses/FallingObject.m25
1 files changed, 23 insertions, 2 deletions
diff --git a/Classes/FallingObject.m b/Classes/FallingObject.m index 515948e..85ea902 100755 --- a/Classes/FallingObject.m +++ b/Classes/FallingObject.m
@@ -11,7 +11,7 @@
11 11
12@implementation FallingObject 12@implementation FallingObject
13 13
14@synthesize sprite, weight; 14@synthesize sprite, weight, delegate;
15 15
16- (id)init 16- (id)init
17{ 17{
@@ -46,6 +46,16 @@
46 { 46 {
47 [self collideWithCart]; 47 [self collideWithCart];
48 48
49 if ((delegate != nil) && ([delegate respondsToSelector:@selector(didCatchItem:)]))
50 {
51 [delegate didCatchItem:self];
52 }
53
54 if ((delegate != nil) && ([delegate respondsToSelector:@selector(didDestroyItem:)]))
55 {
56 [delegate didDestroyItem:self];
57 }
58
49 return YES; 59 return YES;
50 } 60 }
51 } 61 }
@@ -57,6 +67,16 @@
57 { 67 {
58 [self collideWithFloor]; 68 [self collideWithFloor];
59 69
70 if ((delegate != nil) && ([delegate respondsToSelector:@selector(didMissItem:)]))
71 {
72 [delegate didMissItem:self];
73 }
74
75 if ((delegate != nil) && ([delegate respondsToSelector:@selector(didDestroyItem:)]))
76 {
77 [delegate didDestroyItem:self];
78 }
79
60 return YES; 80 return YES;
61 } 81 }
62 82
@@ -75,7 +95,8 @@
75 95
76- (void)dealloc 96- (void)dealloc
77{ 97{
78 [sprite release]; 98 [sprite.parent removeChild:sprite cleanup:YES];
99 [delegate release];
79 [super dealloc]; 100 [super dealloc];
80} 101}
81 102