# Move in a circle?

## Recommended Posts

Well, I want to make a little auto-drawer for a game , and I want to make my cursor to move in a circle... I figure it had something to do with sine and cosine, but I don't know how to... can anyone help me =P?

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

##### Share on other sites

I would say it has to do with: x^2 + y^2 = r^2. Where r is the radius of the desired circle. Then just use a loop with mouse moves, and incrimentation of the x variable. If that didnt make any sense just ask and ill post some code.

##### Share on other sites

I would say it has to do with: x^2 + y^2 = r^2. Where r is the radius of the desired circle. Then just use a loop with mouse moves, and incrimentation of the x variable. If that didnt make any sense just ask and ill post some code.

You could also use Cos() and Sin(), like this

```#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Global \$hGUI, \$hWnd, \$hGraphic,\$x,\$y
Opt("GUIOnEventMode",1)
; Create GUI
\$hGUI = GUICreate("GDI+", 800, 500)
\$hWnd = WinGetHandle("GDI+")
GUISetOnEvent(-3,"close")
GUISetState()

_GDIPlus_Startup()
\$hGraphic = _GDIPlus_GraphicsCreateFromHWND(\$hWnd)

Do
Sleep(50)

_GDIPlus_GraphicsFillEllipse(\$hGraphic, 100*Sin(\$x)+400, 100*Cos(\$y)+250, 70, 70)
\$x+=1
\$y=\$x
Until 0

Func close()
; Clean up resources
_GDIPlus_GraphicsDispose(\$hGraphic)
_GDIPlus_Shutdown()
Exit
EndFunc```
Edited by monoceres

Broken link? PM me and I'll send you the file!

##### Share on other sites

Here is something I wrote:

#427527

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
×
• Create New...