def __init__(self, mode, position=m.Vector(0, 0), direction=m.Vector(0, 0), initial_fishes=c.START_FISHES, fish_radius=100): super(Swarm, self).__init__(mode, position, direction, max_velocity=c.SWARM_MAX_VELOCITY, velocity_decay=c.SWARM_VELOCITY_DECAY) self.target_position = position self.last_pos = position self.fishes = [fish.Fish(self, position + u.random_dir() * fish_radius, u.random_dir()) for _ in range(initial_fishes)] self.swarm_mode = 0 self.maneuver_energy = c.SWARM_MANEUVER_ENERGY_MAX
def new_random_walk_dir(self): self.random_walk_direction = u.random_dir() * c.PREDATOR_RANDOM_WALK_RADIUS
def spawn_trawl(self): trawl_dir = u.random_dir(1, 1) self.trawl = trawl.Trawl(self, self.swarm.position + trawl_dir * c.TRAWL_DISTANCE, trawl_dir * -1)