etwas bewegen lassen

  • Hey,

    gibt es eine Funktion die etwas in eine bestimmte Richtung z.B. bewegt?
    Ein Beispiel:

    Ein Button wird gedrückt und plötzlich geht ein Bild nach oben.?

  • ....wenns nur ums bewegen geht...

    Spoiler anzeigen
    [autoit]

    #include <WinAPI.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $anz = 10

    [/autoit] [autoit][/autoit] [autoit]

    Global $button[$anz + 1], $x[$anz + 1], $y[$anz + 1]
    $gui = GUICreate("Test", 600, 600)
    For $i = 1 To $anz
    $button[$i] = GUICtrlCreateButton($i, 10 + Random(20, 500, 1), 10 + Random(20, 500, 1), 20, 20)
    Next
    GUISetState(@SW_SHOW, $gui)

    [/autoit] [autoit][/autoit] [autoit]

    $variable = 0
    AdlibRegister("_move", 1000)

    [/autoit] [autoit][/autoit] [autoit]

    While guigetmsg()<>-3
    For $i = 1 To $anz
    $a = ControlGetPos($gui, "Test", $button[$i])
    If $a[0] < 10 Then $x[$i] = -$x[$i]
    If $a[1] < 10 Then $y[$i] = -$y[$i]
    If $a[0] > 490 Then $x[$i] = -$x[$i]
    If $a[1] > 490 Then $y[$i] = -$y[$i]
    ControlMove("Test", "", $button[$i], $a[0] + $x[$i], $a[1] + $y[$i], $a[0] / 10, $a[0] / 10)
    Next
    WEnd
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Func _move()
    For $i = 1 To $anz
    $x[$i] = Random(-2, +2, 1)
    $y[$i] = Random(-2, +2, 1)
    Next
    _WinAPI_RedrawWindow($gui)
    EndFunc ;==>_move

    [/autoit] [autoit][/autoit] [autoit][/autoit]