flash - How do you animate a display object in an arc in AS3? -


This is a Flash AS3 only for a game in the project.

The player controls a character gun. By clicking on the screen, the gun pressed a missile in an arc.

Is the best way to calculate the coordination of missiles X and Y for each frame?

Ok, an arc is a piece of a circle, the common form for a circle is

  x = r * cos (a) + cx y = r * sin (a) + cy  

ou r circle radius Is the coordinates of the circle with the angle (in radians), and the cx and cy circle of the circle.

So each frame increases the angle ( a ) and recalculate the position with those formulas.

> This trick will determine appropriate radius and center points

EDIT: To get the same speed on different readi

To get the velocity (pixels / sec) from angular velocity (rad / sec)

  v = Δa * r  

So if we select something v , then Δa = v / r where v is somewhat stable and r is the radius of the circle.


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -