Your
PhysicsObject
's looks
dimensionless points (it is a quite arguable assumption) hence a collision happens if their
{x,y}
coordinates are exactly the same. You might check that this way:
for (i=0; n<physobjarray.length-1; i++) {
for (j=i+1; n<physobjarray.length; j++) {
if ( PhysObjArray[i].x == PhysObjArray[j].x && PhysObjArray[i].y == PhysObjArray[j].y)
{
}
}
}
By the way your
Collisions
methjod should either handle itself the collions (that is their consequences) or return an array containing colliding objects.