Advertisement

rectangular collision

Started by August 09, 2001 06:48 AM
11 comments, last by kolpo 23 years, 6 months ago
sorry the code didn''t post correct(it didn''t post parts of it)

bool isCol(int aX, int aY,int aWidth,int aHeight, int bX, int bY, int bWidth, int bHeight){if ((aX+aWidth)< bX  || aX > (bX+bWidth)) return false;if ((aY+aHeight)< bY || aY > (bY+bHeight)) return false;return true;}  
Ok, that makes sense. BTW, how do you get tag operators to work in this forum anyhow?
Tell him about the twinky...
Advertisement
All these rect collision functions look different even though they do the same thing so i post yet another one that does the same thing.

  inline bool intersecting(const Rect& r1, const Rect& r2){	return (r1.left <= r2.right) &&		(r1.top <= r2.bottom) &&		(r1.right >= r2.left) &&		(r1.bottom >= r2.top);}  

This topic is closed to new replies.

Advertisement