06-22-2006, 10:39 PM | #1 |
Administrator
Founder, System Administrator
Join Date: Nov 2002
Location: United States of America
Age: 50
Posts: 3,052
|
Solve my Problem and Win
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 |
06-22-2006, 10:43 PM | #2 |
Admiral in the Red Army
|
Re: Solve my Problem and Win
So basically, you want it to reflect over the x axis?
I'm not familiar with that language, so I can't really help much. All I can add is that to reflect over x axis, you multiply Y by negative 1 I think.
__________________
|
06-22-2006, 11:11 PM | #3 |
FFR Hall of Fame
|
Re: Solve my Problem and Win
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=-1*angle+180} if(x>=0&&y>=0){angle=-1*angle+360} if(x>=0&&y<0){angle=math.abs(angle)} _root.angletext=angle; // set text to show arrow angle _root.arrow._rotation=angle*-1; // set view of arrow updateAfterEvent();} maybe.
__________________
|
06-22-2006, 11:17 PM | #4 |
FFR Player
|
Re: Solve my Problem and Win
I see >=0
your code is mad. EDIT: How does this have to do with ffr?
__________________
|
06-22-2006, 11:19 PM | #5 | |
Admiral in the Red Army
|
Re: Solve my Problem and Win
Quote:
__________________
|
|
06-23-2006, 12:06 AM | #6 |
FFR Player
|
Re: Solve my Problem and Win
Did you try replacing all the += with -=?
|
09-8-2007, 07:03 PM | #7 |
FFR Player
Join Date: Dec 2005
Age: 34
Posts: 240
|
Re: Solve my Problem and Win
im fairly sure if you set the x variable to -x it would work...
or you could change all angles>1 to negative and add 360 im pretty sure i just repeated what some one else said though |
09-8-2007, 07:16 PM | #8 |
(The Fat's Sabobah)
|
Re: Solve my Problem and Win
Needs more cosine.
|
09-9-2007, 05:00 AM | #10 |
RobMagic
|
Re: Solve my Problem and Win
Then why bump?
|
09-9-2007, 06:16 AM | #11 |
Network Security Analyst
|
Re: Solve my Problem and Win
I'm pretty sure the poor man's way of dealing with this is to turn the monitor upside down or however it would need to be turned and such. but I doubt that will help here.
|
09-9-2007, 01:07 PM | #12 |
FFR Player
Join Date: Dec 2005
Age: 34
Posts: 240
|
Re: Solve my Problem and Win
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|