gvus Posted October 7, 2013 Share Posted October 7, 2013 $centerx=@DesktopWidth / 2 $centery=@DesktopHeight / 2 $CALx=0 $CALy=0 While 1 Local $pos = MouseGetPos() If $pos[0] > $centerx Then $CALx=$centerx-$pos[0] ElseIf $pos[0] < $centerx Then $CALx=$centerx+$pos[0] EndIf If $pos[1] > $centery Then $CALy=$centery-$pos[1] ElseIf $pos[1] < $centery Then $CALy=$centery+$pos[1] EndIf ToolTip(_Angle($CALx,$CALy )) WEnd Func _Angle($X, $Y) Local $CX = $centerx, $CY = $centery If ($CX = $X) And ($CY = $Y) Then Return SetError(1, 0, -1) EndIf Local $Grad = ($Y <= $CY) * 180 - ATan(($CX - $X) / ($CY - $Y)) * 180 / 3.1415926535897932384626 + 90 If $Grad = 360 Then $Grad = 0 EndIf Return $Grad EndFunc ;==>_Angle It sort of works but doesn't. can I get some help here? Link to comment Share on other sites More sharing options...
UEZ Posted October 7, 2013 Share Posted October 7, 2013 Currently I'm sick and my brain doesn't work well but you can try this:Br,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
gvus Posted October 7, 2013 Author Share Posted October 7, 2013 I got this working. Func Angle($tX, $tY, $cX, $cY) $mx = $tX - $cX $my = $cY - $tY $angle = ATan($my / $mx) * $180_div_pi If $mx < 0 Then $angle = 180 + $angle ElseIf $mx >= 0 And $my < 0 Then $angle = 360 + $angle EndIf Return Int($angle) EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now