How to implement path animation?

I have implement game applicaation in which there is one fly.Its flying randomly in application.But io want to fly on particular curve so how to make curve animation.If u have any idea then please advise me.

13.10.2009 13:34:36
Someone please edit this question so it doesn't make my eyes bleed.
Ian Kemp 13.10.2009 13:37:04

Read up on Bezier curves

They basically give you two functions x(t) and y(t) for t in [0,1] if you're working in 2D. You can also add a third function z(t) if you're working in 3D.

So, you start with t=0, and calculate x(0) and y(0) which will place your fly at the start of the path, and then for each frame of animation, you increase t by a delta, calculate the new values for x(t) and y(t). You keep on doing this until t=1, at which point your fly will be at the end of the path.

The value of delta will determine the speed at which your fly moves.

The path will be determined by the control points you use in x(t) and y(t). You can place those control points at random positions, and the end result will still be a smooth movement.

13.10.2009 13:53:41