Skip to content

Instantly share code, notes, and snippets.

@avh4
Created February 6, 2012 04:03
Show Gist options
  • Save avh4/1749471 to your computer and use it in GitHub Desktop.
Save avh4/1749471 to your computer and use it in GitHub Desktop.
Simple collision detection (both objects are rectangular)
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