/** * Check how much overlap there is on the right side of the rectangle. * * @param other rectangle of other object. * @return amount of overlap. */ public final float overlapRight(GameObject other) { float overlap = 0; if (collidesWith(other) && getRight() <= other.getRight()) { overlap = getRight() - other.getLeft(); } return overlap; }