Monday, 29 July 2013

To create screen bound in cocos2d chipmunk

#define PhysicsIdentifier(key) ((__bridge id)(void *)(@selector(key)))


CGSize winSize = [CCDirector sharedDirector].winSize;
        CGRect rect = {CGPointZero, winSize};
        [_space addBounds:rect
                thickness:8.0f
               elasticity:1.0f friction:1.0f
                   layers:CP_ALL_LAYERS group:CP_NO_GROUP
            collisionType:PhysicsIdentifier(COLLISION_TYPE_TERRAIN)

         ];