def move(self, direction, parent): '''Moves the given blob in the given direction. If it is recovering from being shot out, it moves back towards its parent''' if self.recover: px, py = parent.get_absolute_position() parent_vector = (px - self.x, py-self.y) x, y = GameObject.normalize(parent_vector) if math.hypot(px - self.x, py - self.y) < 1.5 * parent.r: self.recover = False elif self.shoot: x, y = GameObject.normalize(self.init_direction) else: x, y = GameObject.normalize(direction) self.x += self.velocity() * x self.y += self.velocity() * y