Last active
March 15, 2022 16:51
-
-
Save oliverbooth/0e4912a50a9af658090311ea5149bbb3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool CollisionTest() | |
{ | |
var aRectangle = new Rectangle(_a.X, _a.Y, _a.Width, _a.Height); | |
var bRectangle = new Rectangle(_b.X, _b.Y, _b.Width, _b.Height); | |
return Intersects(aRectangle, bRectangle); | |
} | |
bool Intersects(Rectangle a, Rectangle b) | |
{ | |
return (b.X < a.X + a.Width) && (a.X < b.X + b.Width) && | |
(b.Y < a.Y + a.Height) && (a.Y < b.Y + b.Height); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment