Important Formulas in This Chapter

So, now you have a few more tools for your toolbox. Here they are.

Convert angular velocity to x, y velocity:

 vx = speed * Math.cos(angle); vy = speed * Math.sin(angle); 

Convert angular acceleration (any force acting on an object) to x, y acceleration:

 ax = force * Math.cos(angle); ay = force * Math.sin(angle); 

Add acceleration to velocity:

 vx += ax; vy += ay; 

Add velocity to position:

 movieclip._x += vx; movieclip._y += vy; 


Foundation ActionScript. Animation. Making Things Move
Foundation Actionscript 3.0 Animation: Making Things Move!
ISBN: 1590597915
EAN: 2147483647
Year: 2005
Pages: 137
Authors: Keith Peters

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net