Nearest way to new angle?

BlitzMax Forums/BlitzMax Programming/Nearest way to new angle?

I just hacked another function to just return my rotation speed:

' Get turn direction
Function GetAngleDir:Int(A1#, A2#)

	Local ret:Int
	
	ret = A1-A2
	If ret >= 180
		ret = -(360 - ret)
	Else
		If ret <= -180
			ret = ret + 360
		EndIf
	EndIf

	' Adjust to speed as I don't want the range to next angle :)
	If (ret <= 0) Return 6
    Return -6

End Function



To get the rotational range to next angle, simply replace

' Adjust to speed as I don't want the range to next angle :)
	If (ret <= 0) Return 6
    Return -6


with


return ret