Created
December 26, 2014 10:38
-
-
Save darkf/4d07a64190f24b4efe21 to your computer and use it in GitHub Desktop.
AABB Box Collision Test
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
// So I don't lose it | |
function boxCollide(a, b) { | |
if ((a.y+a.h <= b.y) || (a.y >= b.y+b.h)) return false; | |
if ((a.x+a.w <= b.x) || (a.x >= b.x+b.w)) return false; | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment