To make efficient and organized use of Box2D, we must create a few wrapper classes to encapsulate specific functionality. In this recipe, we will use these classes to add collision response routines to our simple falling block demo from the previous recipe.
Please refer to the project RecipeCollection02 for full working code of this recipe. Also, note that some code has been omitted for brevity.
/* GameObject.h */ @interface GameObject : CCNode { @public GameArea2D *gameArea; b2Body *body; b2BodyDef *bodyDef; b2FixtureDef *fixtureDef; b2PolygonShape *polygonShape; b2CircleShape *circleShape; CCSprite *sprite; int typeTag; bool markedForDestruction; } /* GameSensor.h */ @interface GameSensor : GameObject {} @property (readonly) int type; @end /* GameMisc.h */ @interface GameMisc : GameObject { @public float life; } @property (readonly) int type; @property (readwrite, assign...