def seperation(self): steering_force = Vector2D() for agent in self.world.agents: if(agent is not self and agent.tagged): toBot = self.pos - agent.pos steering_force += Vector2D.normalise(toBot)/Vector2D.length(toBot) return steering_force
def separation(self,group): steering_force = Vector2D() for agent in group: if self != agent and self.tagged: toBot =self.pos - agent.pos steering_force += Vector2D.normalise(toBot) / toBot.length() return steering_force
def __init__(self, firing_pos, target_pos): self.init_pos = Vector2D.copy(firing_pos) self.pos = self.init_pos self.direction = Vector2D.normalise(target_pos - self.init_pos) self.velocity = 10 self.radius = 5 self.collision = None self.active = True