Chipmunk - simple example

BlitzMax Modules Forums/Brucey's Modules/Chipmunk - simple example

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Demo2 does images, btw :-)

If you look at main2.bmx, at the drawPolyShape() and drawCircleShape() functions, you'll see it does something like this:
	Local body:CPBody = shape.GetBody()
	Local pos:CPVect = body.GetPosition()


	SetRotation body.GetAngle()
	DrawImage crate, pos.x, pos.y

I believe that the body "position" is the midpoint of the body, which makes using images a bit easier - eg. AutoMidHandle().

Of course, if your body is more complex than a square, (perhaps made up of several different shapes), then your image should match that shape.
As you can see from the code, it's not too difficult.