Esempio n. 1
0
    def is_near(self, coordinate: Coordinate, allowed_delta=0.5):
        if not self.position.is_value_known():
            return False

        distance = coordinate.euclidean_distance_from(
            self.position.get_value())
        return distance <= allowed_delta
Esempio n. 2
0
    def can_player_reach(self, position: Coordinate, ticks):
        distance = position.euclidean_distance_from(self.position.get_value())
        extra_time = 1

        if distance <= KICKABLE_MARGIN:
            return True

        if not self.body_facing(position, delta=5):
            extra_time += 1
            if self.body_state.speed > 0.2:
                extra_time += 1

        return self.time_to_rush_distance(distance) <= ticks + extra_time