Page 1 of 1

Some question about Chipmunk

Posted: Tue Apr 08, 2008 1:30 pm
by di3go
Hi guys,

Im new at game development and i started with gosu, im planing to make a 2d side scroller, the map and some monsters gonna be very rich so i cant do the collisions with just retangles, im planning to use the chipmunk to make this collision. I didint used the chipmunk yet, im need know one thing before start to study :)

chipmunk support polygons, right? my idea is to use photoshop to make all the images and the collision mask, then later RMagick to get the X,Y of the collision mask and create a file with a array to make the polygon to use later when the game run (this is all pre-calculated)

but, now is the problem, a monster animation its about 10 images, and some have diferente sizes, everytime i switch the image can i update the chipmunk polygon for that image to make the collision?

Thanks!

Re: Some question about Chipmunk

Posted: Thu Apr 10, 2008 5:14 pm
by slembcke
Chipmunk supports convex polygons (no dents). The simpler the better.

Re: Some question about Chipmunk

Posted: Sat Apr 12, 2008 12:38 am
by Michael Buckley
I have a feeling that changing the shapes attached to a body each frame might cause some odd collision detection behavior in certain cases, but I haven't tested it myself.

Re: Some question about Chipmunk

Posted: Sat Apr 12, 2008 1:01 am
by slembcke
Oh! I misread that. That will be a problem for sure. Changing the shape of the object will not produce a realistic collision response.

Re: Some question about Chipmunk

Posted: Sat Apr 12, 2008 2:08 pm
by Beoran
My advice to you would be: YAGNI, You Aint' Gonna Need It. Just use a rectangular hit box that is a bit smaller than the sprite's bounding box. If you want your monsters to havze a special weak spot, add a "hit box" for that too. Most all classic, famous, 2D console games like Mario, etc, were written on lowly hardware that didn't support much in ways of collision detection. Static hit boxes (rectangles or a set of circles) will most likely be fine. So make it easy on yourself and try to the simple way first. :)