Sign in to follow this  
Followers 0
Vindicator209

Move in a circle?

4 posts in this topic

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 this post


Link to post
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 this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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 :D

#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 this post


Link to post
Share on other sites

Here is something I wrote:

#427527

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0