Skip to content

Instantly share code, notes, and snippets.

@vinniefranco
Created January 27, 2012 22:52
Show Gist options
  • Save vinniefranco/1691400 to your computer and use it in GitHub Desktop.
Save vinniefranco/1691400 to your computer and use it in GitHub Desktop.
function collision_test( obj1, obj2 )
var is_colliding = false;
if ( obj1.x < obj2.x + obj2.w &&
obj1.x + obj1.w > obj2.x &&
obj1.y < obj2.y + obj2.h &&
obj1.y + obj1.h > obj2.y ) {
is_colliding = true;
}
return is_colliding;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment