def step(self, dt):
        if self.at_end_of_spline:
            # time to move to next spline
            self.t = 0
            self.dest_index = (self.dest_index + 1) % len(self.x_points)

            self.x_fun = math_parser.pythonify(
                self.get_spline_string(self.x_points[self.dest_index - 1], self.x_points[self.dest_index])
            )
            self.y_fun = math_parser.pythonify(
                self.get_spline_string(self.y_points[self.dest_index - 1], self.y_points[self.dest_index])
            )

            self.at_end_of_spline = False

        self.t += dt
        inner = self.speed * 0.01 * self.t
        if inner > math.pi:
            self.at_end_of_spline = True
 def __init__(self, x_path_string, y_path_string):
     self.t = 0
     self.path_strings = (x_path_string, y_path_string)  # used for serialization
     self.x_fun = math_parser.pythonify(x_path_string)
     self.y_fun = math_parser.pythonify(y_path_string)