Created
February 6, 2012 04:03
-
-
Save avh4/1749471 to your computer and use it in GitHub Desktop.
Simple collision detection (both objects are rectangular)
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
if (aX < bX + bW | |
&& bX < aX + aW | |
&& aY < bY + bH | |
&& bY < aY + aH) | |
{ | |
// A and B have collided! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment