Jump to content

Recommended Posts

Posted

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]

Posted

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.

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!

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...