OOPS I pressed send before I was done Sorry I''m such a Putz!!
the code could be a shorter if both the source and target width and height are the same.
bool collision(int srcX, int srcY, int srcH, int srcW, int tarX, int tarY,
int tarH, int tarW)
{
UINT xDiff,yDiff;
xDiff = abs(srcY - tarX);
yDiff = abs(srcY - tarY);
if ((xDiff < srcW)&&(xDiff < tarW))&&((yDiff{
return TRUE;
}else
{
return FALSE;
}
}
2D Collision Detectiong Algorithims.....
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement