Here are some routines I added mainly because they are optimized for speed plus they've helped me in the past in making enemy AI...
OriginAngle...
' This function will return the angle from origin 0,0 to X,Y
' Useful to figure out in which direction a set of coordinates
' is from another. By taking 2 sets of coordinates and normalizing them
' (ie: subtract X2-X1, Y2-Y1) will let you find the angle of any coordinate (X1,Y1)
' to any other coordinate. (X2,Y2)
Graphics 640,480,0,2 Print Distance (0,0,10,10) Print OriginAngle(10,10) Print Rad2Deg (OriginAngle(10,10)) Print Deg2Rad(315)
OriginAngle...
' This function will return the angle from origin 0,0 to X,Y
' Useful to figure out in which direction a set of coordinates
' is from another. By taking 2 sets of coordinates and normalizing them
' (ie: subtract X2-X1, Y2-Y1) will let you find the angle of any coordinate (X1,Y1)
' to any other coordinate. (X2,Y2)