Box2D allows the user to set physical properties on bodies to create a wide array of effects. In this example, we see a block of ice pushing a box down a slope. We also see a number of bouncing balls.
Execute the following code:
@implementation Ch4_PhysicalProperties -(CCLayer*) runRecipe { [super runRecipe]; [message setString:@"Friction and restitution"]; //Variable initialization movableObjects = [[[NSMutableArray alloc] init] autorelease]; objectGrabbed = NO; //Create level boundaries [self addLevelBoundaries]; /* Add a crate, a block of ice, bouncing balls and a ledge */ //Crate with 0.4f friction [self addBlockWithSpriteFile:@"crate2.png" friction:0.4f textureSize:64.0f shapeSize:20.0f position:ccp(130,250)]; //Ice block with 0.0f friction [self addBlockWithSpriteFile:@"ice_block.png" friction:0.0f textureSize:70...