# Restricting mc movement

**URL:** <https://forum.kirupa.com/t/restricting-mc-movement/162343>\
**Category:** flash\
**Created:** [September 12, 2005, 11:55am UTC](https://forum.kirupa.com/t/restricting-mc-movement/162343 "2005-09-12T11:55:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lewi\_p](https://avatars.discourse-cdn.com/v4/letter/l/ac91a4/32.png) [@lewi\_p](https://forum.kirupa.com/u/lewi_p)\
**Post date:** [September 12, 2005, 11:55am UTC](https://forum.kirupa.com/t/restricting-mc-movement/162343/1 "2005-09-12T11:55:43Z")

</div>

Hi

I have bit of code that shows the angle which my arrow is pointing, if i move my cursor the arrow changes and so does the text box displaying my angle…trouble is it goes 360 degrees and i want to restrict it from 0-180. any ideas?

Heres the code:

> 

onClipEvent (mouseMove) {  
x=this.\_xmouse;  
y=this.\_ymouse\*-1;  
angle = Math.atan(y/x)/(Math.PI/180);  
if(x\<0){angle+=180}  
if(x\>=0&&y\<0){angle+=360}  
\_root.angletext=angle;  
\_root.arrow.\_rotation=angle\*-1;  
updateAfterEvent();}
