def update(self, delta_time):
    global DEBUG
    move = PVector.Instance(self.dx, self.dy)
    allignment = self.__calc_allignment().mult(self.game.allignment_mult)
    separation = self.__calc_separation().mult(self.game.separation_mult)
    cohesion = self.__calc_cohesion().mult(self.game.cohesion_mult)
    noise = self.__calc_random_noise().mult(self.game.noise_mult)
    if DEBUG:
        console.log('time={} : allign={} : avoid={} : noise={} : cohese={}'.format(delta_time, allignment.mag(), separation.mag(), noise.mag(), cohesion.mag()))
    move.add(allignment)
    move.add(separation)
    move.add(cohesion)
    move.add(noise)
    move.limit(self.game.speed)
    self.dx = move.x
    self.dy = move.y
    self.x = (self.x + ((self.dx * delta_time) / 1000.0))
    if (self.x < 0):
        self.x = (self.x + self.game.canvas.width)
    elif (self.x > self.game.canvas.width):
        self.x = (self.x - self.game.canvas.width)
    self.y = (self.y + ((self.dy * delta_time) / 1000.0))
    if (self.y < 0):
        self.y = (self.y + self.game.canvas.height)
    elif (self.y > self.game.canvas.height):
        self.y = (self.y - self.game.canvas.height)
    PVector.Free(move)
    PVector.Free(allignment)
    PVector.Free(separation)
    PVector.Free(noise)
def update(self, delta_time):
    global DEBUG
    move = PVector.Instance(self.dx, self.dy)
    allignment = self.__calc_allignment().mult(self.game.allignment_mult)
    separation = self.__calc_separation().mult(self.game.separation_mult)
    cohesion = self.__calc_cohesion().mult(self.game.cohesion_mult)
    noise = self.__calc_random_noise().mult(self.game.noise_mult)
    if DEBUG:
        console.log('time={} : allign={} : avoid={} : noise={} : cohese={}'.format(delta_time, allignment.mag(), separation.mag(), noise.mag(), cohesion.mag()))
    move.add(allignment)
    move.add(separation)
    move.add(cohesion)
    move.add(noise)
    move.limit(self.game.speed)
    self.dx = move.x
    self.dy = move.y
    self.x = (self.x + ((self.dx * delta_time) / 1000.0))
    if (self.x < 0):
        self.x = (self.x + self.game.canvas.width)
    elif (self.x > self.game.canvas.width):
        self.x = (self.x - self.game.canvas.width)
    self.y = (self.y + ((self.dy * delta_time) / 1000.0))
    if (self.y < 0):
        self.y = (self.y + self.game.canvas.height)
    elif (self.y > self.game.canvas.height):
        self.y = (self.y - self.game.canvas.height)
    PVector.Free(move)
    PVector.Free(allignment)
    PVector.Free(separation)
    PVector.Free(noise)