Angle between two XY positions

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

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.

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