def __init__(self, x, y, length, wheel_radius): direction = random.uniform(-pi, pi) super().__init__(x, y, length, Color.random_color(127, 127, 127), Color.BLACK, direction) self.length = length self.wheel_radius = wheel_radius self.speed_left_wheel = 0.0 # angular velocity of left wheel self.speed_right_wheel = 0.0 # angular velocity of left wheel self._delta = 0.01 self.deltax = None self.deltay = None
def add_walls(self, number_to_add=1): for i in range(number_to_add): x1 = random.randint(0, self.scene.width) y1 = random.randint(0, self.scene.height) point1 = Point(x1, y1) x2 = random.randint(0, self.scene.width) y2 = random.randint(0, self.scene.height) point2 = Point(x2, y2) wall = self.build_wall(point1, point2, Color.random_color(127, 127, 127)) self.scene.put(wall)
def __init__(self, settings, max_width, max_height, max_nth_initial_radius=3): pos_coordinate = RandomCoordinate(max_width, max_height) vector = RandomVector(settings) color = Color.random_color() if settings.random_color else Color.PURPLE width = randint(1, settings.max_bubble_line_width) max_radius = randint(1, settings.max_bubble_radius) max_generated_radius = max_radius // max_nth_initial_radius if max_generated_radius < 1: max_generated_radius = 1 if settings.max_bubble_line_width < max_generated_radius: radius = randint(settings.max_bubble_line_width, max_generated_radius) else: radius = settings.max_bubble_line_width super().__init__(pos_coordinate, vector, color, radius, width, max_radius)