Created
May 14, 2013 22:54
-
-
Save DrewDahlman/5580343 to your computer and use it in GitHub Desktop.
Collision Detection
This file contains 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
self.check_collision = function(x1, y1, w1, h1, x2, y2, w2, h2) { | |
w2 += x2; | |
w1 += x1; | |
if (x2 > w1 || x1 > w2) return false; | |
h2 += y2; | |
h1 += y1; | |
if (y2 > h1 || y1 > h2) return false; | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment