# Rotation using left, right, up and down

**URL:** <https://forum.kirupa.com/t/rotation-using-left-right-up-and-down/281934>\
**Category:** flash\
**Created:** [February 15, 2009, 4:21pm UTC](https://forum.kirupa.com/t/rotation-using-left-right-up-and-down/281934 "2009-02-15T16:21:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TZP](https://avatars.discourse-cdn.com/v4/letter/t/5f9b8f/32.png) [@TZP](https://forum.kirupa.com/u/TZP)\
**Post date:** [February 15, 2009, 4:21pm UTC](https://forum.kirupa.com/t/rotation-using-left-right-up-and-down/281934/1 "2009-02-15T16:21:42Z")

</div>

Good day to you.  
First of all: Forgive me for my englisch, because I´m from germany. I hope no one blames me for that. ^^  
Anyway I got a question and maybe one of you guys can help me. The problem:  
I want to rotate and move a MC with the keys “left”, “right”, “up” and “down”. I know how to rotate it in a static way

```auto

if(up) ship.rotationZ = 0;
if(up && right) ship.rotationZ = 45;
if(right) ship.rotationZ = 90;
if(right && down) ship.rotationZ = 135;
...
...

```

Works fine but I want it to move smooth. Tweening doesn´t work because I have to use a fix degree as destination.  
Let´s say I want to go from up(North) to (left)West. The shortest way is from 0° to -90°. But when I want to go from (down)South to (left)West it is from 180° to 270°…always use the shortest way. I know that there are a bunch of tutorials where I can rotate just by using left and right and up for speed but I want it on every direction like a compass. Is there any way to do this or will that be just my own dream?

Thx!  
TZP
