public final boolean collides(Entity other) { return other.dist(this) < radius + other.radius; }
// changes the direction of an object calling this function by checking to // see whether a new direction will get it closer to the heading that it wants; // double t is the current heading private boolean isCloser(double t) { double dx = Math.cos(theta) * targetVel, dy = Math.sin(theta) * targetVel; double tdx = Math.cos(t) * targetVel, tdy = Math.sin(t) * targetVel; return target.dist(x + dx, y + dy) > target.dist(x + tdx, y + tdy); }
public Helper.Intersection intersectPoint(Entity other) { return Helper.intersectPoint(getBounds(), other.getBounds()); }