first post hello, everyone,
i'm very new to Chipmunk, and currently only using it for a very small labyrinth game-style widget, with balls rolling around a bordered box. i implemented this fine using Chipmunk-Pro, so decided to go back and do the same using vanilla Chipmunk.
Everything has gone fine except for creating the border for the game board. i've tried everything, but nothing seems to create a shape. for the time being, i tried just creating a single "floor" shape, but no luck with this either:
Code: Select all
self.space = cpSpaceNew();
cpSpaceSetGravity(self.space, cpv(0, kGravityMultiplier));
cpShape *shape;
// shape
shape = cpSpaceAddShape(self.space,
cpSegmentShapeNew(cpSpaceGetStaticBody(self.space),
cpv(0, 0),
cpv(320, 0),
0.0f)
);
cpShapeSetElasticity(shape, 1.0f);
cpShapeSetFriction(shape, 1.0f);
this seems like such a simple thing, and is so easy in Chipmunk Pro that i have no idea where i'm going wrong here. also, it seems rather odd there isn't a more convenient way to add a rectangular bounds around a cpSpace... anyway, hope some can help!
thanks