Okay, I must be more dumb or tired than I think I am, because I can't quite figure out how to do this...and I usually don't have problems with SIN and COS.
This problem needs to calculate distance though, and that probably needs SQR and I'm not so strong there.
What I need is an easy way to calculate the angle of the shortest distance from the cursor to any edge of the screen.
The following example doesn't do what I want, but it's a framework.
Can someone help me with the code needed to calculate the angle to draw the shortest possible line, from the cursor to the edge of the screen?
Thanks.
This problem needs to calculate distance though, and that probably needs SQR and I'm not so strong there.
What I need is an easy way to calculate the angle of the shortest distance from the cursor to any edge of the screen.
The following example doesn't do what I want, but it's a framework.
Can someone help me with the code needed to calculate the angle to draw the shortest possible line, from the cursor to the edge of the screen?
Graphics 640,480,16,2 Repeat Cls mx=MouseX():my=MouseY() For angle=0 To 360 Step 12; Speed is more important than precision. tox = mx+Sin(angle) * 200;Just a random number toy = my-Cos(angle) * 200 Line mx,my,tox,toy Next Flip Until KeyHit(1)
Thanks.