Advertisement

Image overlap colision detection

Started by November 02, 2004 05:33 PM
1 comment, last by raptorstrike 20 years, 4 months ago
ok my question is: can you do this in SDL and what kind of overhead are we talking about and would bound boxing be easyer?
____________________________"This just in, 9 out of 10 americans agree that 1 out of 10 americans will disagree with the other 9"- Colin Mochrie
You probably need to start with bounding box. You should come up with your own pixel by pixel when you get some more basics down.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One
Advertisement
ok one last thing,, when SDL sets an image to a rect it sets the top left corner to the |Rect| right?

asumming this would this be a good function to have

BOOL Sprite_Collision(SDL_Rect R_Hitter,SDL_Surface* I_Hitter,SDL_Rect R_Hittee,SDL_Surface* I_Hittee)
{
if( ((R_Hitter.x <= R_Hittee.x+I_Hittee->w) && (R_Hitter.x >= R_Hittee.x)) && ((R_Hitter.y <= R_Hittee.x+I_Hittee->h) && (R_Hitter.y >= R_Hittee.y)))
{
I_Hitter = NULL;
};
};

i just want a function that will delete the hitter when it enters the bounding rectangle of another object

[Edited by - raptorstrike on November 2, 2004 8:58:50 PM]
____________________________"This just in, 9 out of 10 americans agree that 1 out of 10 americans will disagree with the other 9"- Colin Mochrie

This topic is closed to new replies.

Advertisement