Here .. set no of possible image directions by changing Segs .. You could probably simplify the imageNo calc but I can't really think atm.
Hope it helps.
Hope it helps.
Graphics 640,480,16,1 Global ImageNo Global PlayerX# = 320 Global PlayerY# = 240 Global Segs = 16 SetBuffer BackBuffer() While Not KeyDown(1) Cls ;show angle range Color 128,128,128 For l = 0 To Segs-1 A# = ( Float(l) + .5 ) * ( 360.0 / Float( Segs ) ) Line 320 , 240 , 320 + 100 * Cos( A ) , 240 + 100 * Sin( A ) Next ;get angle from player to cursor Dx# = MouseX() - PlayerX Dy# = MouseY() - PlayerY If Sqr( Dx * Dx + Dy * Dy ) > 5.0 Angle# = ATan2 ( Dy , Dx ) ImageNo = Floor( ( ( Angle + 360 ) Mod 360 + ( 180 / Segs ) ) / ( 360 / Segs ) ) Mod Segs EndIf Color 255,255,0 Text 0,0,"Angle : "+Angle Text 0,10,"Image No : "+ImageNo ;draw player Color 255,0,0 Oval PlayerX - 5, PlayerY - 5 , 11, 11 ;draw cursor Color 255,255,255 Line MouseX() - 5 , MouseY(), MouseX() +5, MouseY() Line MouseX(), MouseY()-5, MouseX(), MouseY()+5 Flip Wend