# Auto Rotate

**URL:** <https://forum.kirupa.com/t/auto-rotate/50347>\
**Category:** programming\
**Created:** [May 2, 2004, 2:58am UTC](https://forum.kirupa.com/t/auto-rotate/50347 "2004-05-02T02:58:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cr125rider](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/cr125rider/32/534_2.png) [@cr125rider](https://forum.kirupa.com/u/cr125rider)\
**Post date:** [May 2, 2004, 2:58am UTC](https://forum.kirupa.com/t/auto-rotate/50347/1 "2004-05-02T02:58:32Z")

</div>

I am fairly new to flash and was wondering if someone could help me make a code so that a MC rotates in the direction it just moved. Say I make it go left, it would then rotate from its facing up to pointing left. I am trying to make it do this automaticly. I was thinking of using XPrevious and YPrevious variables to determine the direction it moved. I dont know if AS has a build in function for determining the direction to a point (If it doesn’t, could you help me make one). and then adding 180 to the MC’s current direction: Direction. If you could pass me off to a tut that would be much appreciated also.

Thanks for your help,
