How to caclulate an angle?

BlitzMax Forums/BlitzMax Programming/How to caclulate an angle?

You should be using atan2(x1-x1,y1-y2)
The handle for the rect is topleft so it has problems with
the rotations.
drawrect and handle
Graphics 640,480

Local x:Float = 320
Local y:Float = 240

Local Angle:Float = 0

While Not KeyHit(key_escape)
	Cls
		
	Angle = ATan2((MouseX() - x),(y - MouseY()))
	SetRotation(Angle)
	DrawRect x,y,40,40
	SetRotation(0)
	DrawLine (x,y,MouseX(),MouseY())
	
	Flip
Wend