Skip to content

Instantly share code, notes, and snippets.

@DrewDahlman
Created May 14, 2013 22:54
Show Gist options
  • Save DrewDahlman/5580343 to your computer and use it in GitHub Desktop.
Save DrewDahlman/5580343 to your computer and use it in GitHub Desktop.
Collision Detection
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