Public Function GoToMouse(ByVal sprPosX As Double, ByVal sprPosY As Double, ByVal sprPosSpeed As Double, ByVal mouseX As Double, ByVal mouseY As Double, ByRef MoveX As Double, ByRef MoveY As Double) As Boolean
Try
Dim xDiff As Double = CDbl(mouseX - sprPosX)
Dim ydiff As Double = CDbl(mouseY - sprPosY)
Dim Length As Double = xDiff * xDiff + ydiff * ydiff
Length = Sqrt(Length)
MoveX = (sprPosX - mouseX) / Length * sprPosSpeed
MoveY = (sprPosY - mouseY) / Length * sprPosSpeed
Catch
End Try
End Function