def __init__(self): graphics.Scene.__init__(self) self.segments = [] # we should redo the boxes when window gets resized self.proximity_radius = 10 self.proximities = LQProximityStore(Vector2(0, 0), Vector2(600, 400), self.proximity_radius) self.flock = [] self.frame = 0 self.connect("on-click", self.on_mouse_click) self.connect("on-enter-frame", self.on_enter_frame)
def __init__(self): graphics.Scene.__init__(self) # we should redo the boxes when window gets resized box_size = 10 self.proximities = LQProximityStore(Vector2(0,0), Vector2(600,400), box_size) self.waypoints = [] self.waypoints = [QueueingWaypoint(100, 100, 70), BucketWaypoint(500, 100, 10), GrowWaypoint(500, 500, 10), QueueingWaypoint(300, 500, 70), BucketWaypoint(100, 500, 10), GrowWaypoint(100, 300, 3), ] for waypoint in self.waypoints: self.add_child(waypoint) # link them together for curr, next in zip(self.waypoints, self.waypoints[1:]): curr.next = next next.previous = curr self.waypoints[0].previous = self.waypoints[-1] self.waypoints[-1].next = self.waypoints[0] self.boids = [Boid(Vector2(100,100), 2.0) for i in range(15)] for i, boid in enumerate(self.boids): boid.target(self.waypoints[0]) self.add_child(boid) self.mouse_node = None # some debug variables self.debug_radius = False self.debug_awareness = False self.connect("on-enter-frame", self.on_enter_frame)