Hi !
how to code this :
When distance between the player and the enemy is less than 300 pixels the enemy start turn arround the player. When the player move, it continue to turn arround it ! Thanks for your help and yours ideas !
Just a code to begin
how to code this :
When distance between the player and the enemy is less than 300 pixels the enemy start turn arround the player. When the player move, it continue to turn arround it ! Thanks for your help and yours ideas !
Just a code to begin
Strict Graphics 1024,768 Global Enemy_x# = 300 Global Enemy_y# = 400 Global Player_x# = GraphicsWidth() / 2 Global Player_y# = GraphicsHeight() / 2 Global d# Global angle# = 0.0 MoveMouse Player_x#, Player_y# While Not KeyDown(KEY_ESCAPE) Cls SetColor 255,255,255 DrawOval Player_x#-2, Player_y#-2,4,4 SetColor 0,255,0 DrawOval Enemy_x#-2, Enemy_y#-2,4,4 Player_x# = MouseX() Player_y# = MouseY() SetColor 255,0,0 d# = Float ( (Player_x# - Enemy_x#) * (Player_x# - Enemy_x#) + (Player_y# - Enemy_y#) * (Player_y# - Enemy_y#) ) If d < 300 * 300 Then If angle# < 360 Then angle# = angle# + 1.0 Else angle# = 0.0 End If Local xmov# = Cos (Angle#) * 2.0 Local ymov# = Sin (Angle#) * 2.0 Enemy_x# = Enemy_x# + xmov# Enemy_y# = Enemy_y# + ymov# End If SetColor 255,255,255 DrawText "d=" + Sqr(d),0,0 Flip Wend