June 2014
Beginner to intermediate
434 pages
9h 49m
English
Most of the times you'll want your object to stay on the screen instead of falling into the abyss. So, let's add some ground that will stop the stone from falling further. Refer to the following steps:
PhysicsScene.m file and add the _ground instance variable:@implementation PhysicsScene
{
//..skipped..
CCSprite *_ground;
}#define statement, between kBackgroundZ and kObjectsZ as shown in the following code:#define kBackgroundZ 10
#define kGroundZ 15
#define kObjectsZ 20addGround method as follows:-(void)addGround { //1 _ground = [CCSprite spriteWithImageNamed:@"ground.png"]; //2 CGRect groundRect; groundRect.origin = CGPointZero; ...