diff options
author | Starla Insigna <starla4444@gmail.com> | 2011-08-12 09:51:50 -0400 |
---|---|---|
committer | Starla Insigna <starla4444@gmail.com> | 2011-08-12 09:51:50 -0400 |
commit | d19677f9f73d8fe7436982bdf8d40f69d69d1b43 (patch) | |
tree | 74853f369ef51bc9f9f595ff31153ce1a718e651 /Classes/FallingObject.m | |
parent | 07f40d804de35d1cead13217c448811e774e6e67 (diff) | |
download | cartcollect-d19677f9f73d8fe7436982bdf8d40f69d69d1b43.tar.gz cartcollect-d19677f9f73d8fe7436982bdf8d40f69d69d1b43.tar.bz2 cartcollect-d19677f9f73d8fe7436982bdf8d40f69d69d1b43.zip |
Added tutorial mode
GameLayer was also renamed to ClassicGameMode and its pause functionality and score/lives counters were moved out to GameMode. FallingObjectDelegate was created to allow for custom code to be run when items were caught/missed, something that is used extensively by tutorial mode. Important: Cart Collect's bundle identifier was changed in this revision from com.fourisland.Cart-Collect to com.apatheticink.Cart-Collect, so ensure that before attempting to compile/run this build, you clear your build directory and remove the old version of Cart Collect from your device. Closes #193
Diffstat (limited to 'Classes/FallingObject.m')
-rwxr-xr-x | Classes/FallingObject.m | 25 |
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 | ||