Angle between two XY positions

BlitzMax Forums/BlitzMax Beginners Area/Angle between two XY positions

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

Use ATan2(y, x)...

Graphics 800, 600, 0

SetLineWidth 5

Repeat
	Cls
	ang# = ATan2(300 - MouseY(), 400 - MouseX())
	
	DrawLine 400, 300, 400 - (Cos(ang) * 100), 300 - (Sin(ang) * 100)
	
	DrawText ang, 0, 0
	
	FlushMem
	Flip
Until KeyHit(KEY_ESCAPE)

End