Fix Grid collisions with Hitbox
I've noticed some unexpected behaviour when using Grid - hitboxes colliding with a wrong offset. This change seems to fix the issue, so I thought I'd send it over for review.
It looks like collideMask might have a similar mistake - but I haven't tested it.
I don't doubt there's an issue here, but the original makes more sense to me than the patch: the original is (mask X - entity X) - (other mask X - other entity X) which gives you the difference in compensated positions; the new one flips it to (mask X - entity X) + other mask X + other entity X.
Isn't the original equivalent to:
(otherEntityX - otherMaskX) - (EntityX + MaskX)?
If we want the difference in positions, shouldn't we be doing this instead:
(otherEntityX + otherMaskX) - (EntityX + MaskX)
I apologize if there's something I'm missing.
I think you're right about what we want, I need to look more closely at this logic. However:
_rect.x = other._parent.x - other._x - _parent.x + _x;
is the same as (just moving them around):
_rect.x = _x - _parent.x - other._x + other._parent.x;
which is the same as:
_rect.x = (_x - _parent.x) - (other._x - other._parent.x);
So it's consistent now, even if it's doing the wrong thing, and flipping a sign is probably not the right fix.