PDA

View Full Version : direction of movieclips



schling
February 12th, 2003, 03:44 PM
Hi

I am just wondering how I change the direction of a movie clip. And how to make it change in the same it's moving.


I have random movement code on the clip, I just want it to rotate, in the direction it goes.

Did this make any sense?

schling

bit-101
February 12th, 2003, 04:37 PM
if you have its velocity on the x axis - vx, and on the y axis - vy, the rotation is found by saying:

_rotation=Math.atan2(vy, vx)*180/Math.PI;

make sure the unrotated clip is facing East (to the right)

schling
February 12th, 2003, 05:12 PM
Thanks man :-)