def line_of_sight_blocked_at(x1, y1, x2, y2)
      distance_to_travel = Gosu::distance x1, y1, x2, y2
      distance_x, distance_y = x2 - x1, y2 - y1
      distance_travelled = 0
      x, y = x1, y1

      loop do
        distance = sample_distance x, y

        # Blocked?
        return [x, y] if distance <= 0

        distance_travelled += distance

        # Got to destination in the clear.
        return nil if distance_travelled >= distance_to_travel

        lerp = distance_travelled.fdiv distance_to_travel
        x = x1 + distance_x * lerp
        y = y1 + distance_y * lerp
      end
    end
def line_of_sight_blocked_at(x1, y1, x2, y2)
      distance_to_travel = Gosu::distance x1, y1, x2, y2
      distance_x, distance_y = x2 - x1, y2 - y1
      distance_travelled = 0
      x, y = x1, y1

      loop do
        distance = sample_distance x, y

        # Blocked?
        return [x, y] if distance <= 0

        distance_travelled += distance

        # Got to destination in the clear.
        return nil if distance_travelled >= distance_to_travel

        lerp = distance_travelled.fdiv distance_to_travel
        x = x1 + distance_x * lerp
        y = y1 + distance_y * lerp
      end
    end
Returns blocking position, else nil if line of sight isn't blocked.