How to caclulate an angle?

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

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

...and with Sethandle suggested by Eikon...
Graphics 640,480

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

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