From fd58a0cde1bb5473e39e6cb82d28113da84b9ae0 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Sat, 10 Sep 2011 17:07:13 -0400 Subject: 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. --- Classes/GameMode.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Classes/GameMode.h') diff --git a/Classes/GameMode.h b/Classes/GameMode.h index e82ad10..cd0359d 100644 --- a/Classes/GameMode.h +++ b/Classes/GameMode.h @@ -8,6 +8,7 @@ #import "CCLayer.h" #import "Cart.h" +#import "FallingObjectFactory.h" #define GAME_SCENE 436 #define GAME_LAYER 437 @@ -18,6 +19,7 @@ int lives; int pointMultiplier; Cart* cart; + FallingObjectFactory* objectFactory; CCLayerColor* shadedLayer; CCLayer* pauseLayer; -- cgit 1.4.1