[SDL] Orbiting sprites.
heller at teragram.com
Wed Sep 24 14:41:01 PDT 2003
Ah, now things are starting to become clear.
That looks familiar.
I'll test it out this evening (no game coding at work :-( ) and let you
know how it goes.
From: Neil Brown [mailto:neil at twistedsquare.com]
Sent: Wednesday, September 24, 2003 5:36 PM
To: sdl at libsdl.org
Subject: RE: [SDL] Orbiting sprites.
>So I guess my question is a simple as what do I need to do to calculate
>movement along a curved path?
>Something is telling me this all comes down to basic trigonometry,
I came in late on this one but assuming you're in 2d here (not 3d):
You have two radiuses for most ellipses, rx and ry (horizontal and
Each iteration you want to move A radians around the ellipse, from your
previous position of P radians.
So each iteration your movement must be:
X direction: cos(A+P)*rx - cos(P)*rx
Y direction: sin(A+P)*ry - sin(P)*ry
I think thats the sort of thing you are looking for right? Tell me if
Ive misunderstood (or indeed if the above is wrong!)
SDL mailing list
SDL at libsdl.org
More information about the SDL