I use the Vec2d <http://www.pygame.org/wiki/2DVectorClass?parent=CookBook>class defined in the Pygame cookbook, plus a simplification of the calculate_bezier() <http://www.pygame.org/wiki/BezierCurve?parent=CookBook>function also there. Here's the code:
def calculate_lerp(p, steps = 30): t = 1.0 / steps points = [p[0].interpolate_to(p[1], t*i) for i in range(0, steps+1)] return points On Mon, Aug 16, 2010 at 10:13 PM, Mark Reed <markree...@gmail.com> wrote: > I want to calculate a straight path of points between two points and > each frame do: > > sprite.x, sprite.y = sprite.path[step] > step++ > > And have the sprite move along that line. I've lost all basic math > skills, and don't want to spend an hour debugging such a simple thing. > > Mark > > On Tue, Aug 17, 2010 at 9:41 AM, Luke Paireepinart > <rabidpoob...@gmail.com> wrote: > > Can you be more specific about what you mean? Are you trying to > interpolated points between two endpoints or what? > > > > Sent from my iPhone > > > > On Aug 16, 2010, at 8:13 PM, Mark Reed <markree...@gmail.com> wrote: > > > >> Anyone have a function for calculating all the points on a line to be > >> used for sprite movement? > >> > >> Mark > > >