Help me solve my problem with this code and I will release an alpha version of a new concept I am working on.
Here is the code...
onClipEvent (mouseMove) {
x=this._xmouse;
trace("x mouse = "+x);
y=this._ymouse*-1;
trace("y mouse = "+y);
angle = Math.atan(y/x)/(Math.PI/180);
_root.angle = angle;
if(x<0){angle+=180}
if(x>=0&&y<0){angle+=360}
_root.angletext=angle; // set text to show arrow angle
_root.arrow._rotation=angle*-1; // set view of arrow
updateAfterEvent();}
This code figures out the angle of your mouse pointer in relation to a predefined axis. The code works great, no complaints here about the way it is written.
Here is my issue with it:
If you are to the right of the axis, you are at 0 degrees. If you are above the axis you are at 90 degrees. Below and you are at 270 degrees. To the left and you are at 180 degrees.
Make sense? Hopefully yes..
Now, what needs to change is for right to be 0 degrees. above to be 270 degrees. Below to be 90 degrees. Left 180 and right 0 degrees.
Still make sense?
Now change my code to think this way and I will release this mini-concept tomorrow on the site.
Good luck.
Cheers,
Synthlight
Here is the code...
onClipEvent (mouseMove) {
x=this._xmouse;
trace("x mouse = "+x);
y=this._ymouse*-1;
trace("y mouse = "+y);
angle = Math.atan(y/x)/(Math.PI/180);
_root.angle = angle;
if(x<0){angle+=180}
if(x>=0&&y<0){angle+=360}
_root.angletext=angle; // set text to show arrow angle
_root.arrow._rotation=angle*-1; // set view of arrow
updateAfterEvent();}
This code figures out the angle of your mouse pointer in relation to a predefined axis. The code works great, no complaints here about the way it is written.
Here is my issue with it:
If you are to the right of the axis, you are at 0 degrees. If you are above the axis you are at 90 degrees. Below and you are at 270 degrees. To the left and you are at 180 degrees.
Make sense? Hopefully yes..
Now, what needs to change is for right to be 0 degrees. above to be 270 degrees. Below to be 90 degrees. Left 180 and right 0 degrees.
Still make sense?
Now change my code to think this way and I will release this mini-concept tomorrow on the site.
Good luck.
Cheers,
Synthlight





Comment