Skip to content

Instantly share code, notes, and snippets.

@southill
Last active January 14, 2019 01:36
Show Gist options
  • Save southill/7a9d9e94f751f145899d0c74997e3a6e to your computer and use it in GitHub Desktop.
Save southill/7a9d9e94f751f145899d0c74997e3a6e to your computer and use it in GitHub Desktop.
hittest hit test
function hitTestObject(a,b){
var area_0 = [a.x,a.y,66,66];
var area_1 = [b.x,b.y,87,66];
return !(area_0[0] + area_0[2] < area_1[0]
|| area_0[0] > + area_1[0] + area_1[2]
|| area_0[1] + area_0[3] < area_1[1] || area_0[1] > + area_1[1]
+ area_1[3]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment