diff options
author | Starla Insigna <starla4444@gmail.com> | 2011-09-10 17:07:13 -0400 |
---|---|---|
committer | Starla Insigna <starla4444@gmail.com> | 2011-09-10 17:07:13 -0400 |
commit | fd58a0cde1bb5473e39e6cb82d28113da84b9ae0 (patch) | |
tree | 8d36b2fedc3c056c002a881e78340c7b56bbabea /Classes/FallingObject.h | |
parent | 5ccc4fc305f502a552b1ac7e815e576c93a8159a (diff) | |
download | cartcollect-fd58a0cde1bb5473e39e6cb82d28113da84b9ae0.tar.gz cartcollect-fd58a0cde1bb5473e39e6cb82d28113da84b9ae0.tar.bz2 cartcollect-fd58a0cde1bb5473e39e6cb82d28113da84b9ae0.zip |
Reworked falling objects
Previously, every type of falling object had to have its own class that defined the object type's sprite, weight, and reaction to the cart/floor. This was pretty messy considering how many object types may only be used in one game mode--for instance, the many power ups in Power mode, once it's created, will never be used outside of Power mode. So, to increase customizability and decrease class clutter, game modes now use a FallingObjectFactory to define recipes (basically a sprite filename, a weight and an identifier) that can easily be built throughout the game mode using the identifier. FallingObjectDelegate is now used for all reactions to the cart/floor, rather than defining a standard reaction in the FallingObject subclass and then putting extra stuff in FallingObjectDelegate.
Diffstat (limited to 'Classes/FallingObject.h')
-rwxr-xr-x | Classes/FallingObject.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Classes/FallingObject.h b/Classes/FallingObject.h index d3ac638..d9406d5 100755 --- a/Classes/FallingObject.h +++ b/Classes/FallingObject.h | |||
@@ -15,15 +15,15 @@ | |||
15 | int weight; | 15 | int weight; |
16 | id<FallingObjectDelegate> delegate; | 16 | id<FallingObjectDelegate> delegate; |
17 | BOOL flags[4]; | 17 | BOOL flags[4]; |
18 | int objectType; | ||
18 | } | 19 | } |
19 | 20 | ||
20 | @property (readonly) CCSprite* sprite; | 21 | @property (readonly) CCSprite* sprite; |
21 | @property (readonly) int weight; | 22 | @property (readonly) int weight; |
23 | @property (readonly) int objectType; | ||
22 | @property (nonatomic,retain) id<FallingObjectDelegate> delegate; | 24 | @property (nonatomic,retain) id<FallingObjectDelegate> delegate; |
23 | - (id)init; | 25 | - (id)initWithSpriteFilename:(NSString*)filename weight:(int)weight objectType:(int)objectType; |
24 | - (BOOL)tick; | 26 | - (BOOL)tick; |
25 | - (void)collideWithCart; | ||
26 | - (void)collideWithFloor; | ||
27 | - (BOOL)flag:(int)flag; | 27 | - (BOOL)flag:(int)flag; |
28 | - (void)setFlag:(int)flag withValue:(BOOL)value; | 28 | - (void)setFlag:(int)flag withValue:(BOOL)value; |
29 | 29 | ||