EDIT: use ATan2() instead, it does all of this for you.
To get the angle from one point to another, subtract and use arctan:
I snagged this from some of my code in an old discussion about Plobb. There may be a more elegant approach.
To get the angle from one point to another, subtract and use arctan:
Local dir# Local dx# = p\x - MouseX() Local dy# = p\y - MouseY() If dy < 0 Then dir = ATan(dx/dy) If dy > 0 Then dir = ATan(dx/dy) + 180 If dy = 0 Then ; don't divide by 0! If dx < 0 Then dir = 90 Else dir = 270 EndIf
I snagged this from some of my code in an old discussion about Plobb. There may be a more elegant approach.