Game Development Reference
In-Depth Information
And if you need help, you can find that in the Chipmunk forums: .
Chipmunks in Space
For the Chipmunk tutorial, you'll build the same project as before. You can find the
resulting code in the PhysicsChipmunk01 project. Listing 12-8 shows the Chipmunk
version of the HelloWorldLayer header file.
Listing 12-8. The Chipmunk HelloWorld Interface
#import "cocos2d.h"
#import "chipmunk.h"
#define TILESIZE 32
#define TILESET_ROWS 19
@interface HelloWorldLayer : CCLayer
CCTexture2D* spriteTexture;
cpSpace* space;
cpShape* walls[4];
+(CCScene*) scene;
There's nothing unusual here, except for the cpSpace and cpShape instance vari-
ables. Instead of world , Chipmunk calls its world a space . It's just a different term for
the same thing. The Chipmunk space contains all the rigid bodies. And the wall shapes
define the screen boundary collisions. The walls array is only needed so the walls
Search Nedrilad ::

Custom Search