Collision Detection


I have made a site @ Sparky2X for me and my GP2X stuff. I will be posting regular updates on the game. :)

Btw, thanks for the sdl-collide library link. It was very helpful.
 
Personally, I like to just compare the distance on X and Y axes between the centerpoints of objects (their position in X and Y set as variables on the object, plus half the size of the object.. e.g. the centerpoint of a 32x32 object being object->pos_x + object->width*0.5,object->pos_y + object->height*0.5) .. with varying distances dictating whether a collision has occurred or not. The hit 'boxes' on my objects are NOT the same size as the objects, however. That works really well for the top-scrolling shooter engine I am developing; but it might not work as well for your application. You might give it a shot though.
 
Back
Top