1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. Nathax

Beiträge von Nathax

  • RectCollison

    • Nathax
    • 16. Dezember 2009 um 17:13

    meinste so??

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <WindowsConstants.au3>
    #include <StaticConstants.au3>
    #include <Array.au3>
    #Include <Misc.au3>

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

    HotKeySet("{ESC}", "ende")

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

    ; Hauptvariablen-------------------------
    $f = 0
    Global $guix, $guiy
    Global $fischx = 200, $fischy = 300, $movex = 10, $movey = 10
    ; ---------------------------------------

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

    ; Guierstellung--------------------------
    $gui1 = GUICreate ("Aquarium",(@DesktopWidth), (@DesktopHeight-65),0,0)
    GUISetBkColor(0x0000ff,$gui1)
    $hintergrund = GUICtrlCreatepic("bilder\hintergrund.gif",0,0,@DesktopWidth,@DesktopHeight-50)
    $fisch1 = GUICtrlCreatepic("bilder\fischrechts1.gif",$fischx,$fischy, 120,100)
    $futter = GUICtrlCreatePic("bilder\futter.gif",-200,-200,100,100)
    GUISetState (@SW_SHOW)
    ; ---------------------------------------

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

    AdlibEnable("move_fisch", 20)

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

    ; Hauptfunktion des Guis-----------------
    While 1
    $c = GUIGetCursorInfo()
    $f1pos = ControlGetPos( "Aquarium", "", $fisch1)
    $fupos = ControlGetPos( "Aquarium", "", $futter)
    $msg = GUIGetMsg()
    _RectCollision($f1pos[0], $f1pos[1], $f1pos[0]+200, $f1pos[1]+300, $fupos[0], $fupos[1], $fupos[0]+100, $fupos[1]+100)
    Select
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    EndSelect
    If _IsPressed("01") and $f = 1 Then
    GUICtrlDelete($futter)
    $futter = GUICtrlCreatePic("bilder\futter.gif",$c[0]-40,$c[1]-40,100,100)
    $f = 1
    ElseIf _IsPressed("01") and $f = 0 then
    $futter = GUICtrlCreatePic("bilder\futter.gif",$c[0]-40,$c[1]-40,100,100)
    $f = 1
    Endif

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

    Wend
    ; ---------------------------------------

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

    ; Funktionen-----------------------------
    Func ende()
    Exit
    EndFunc

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

    Func move_fisch()
    Select
    Case $fischx < 0
    GUICtrlSetImage($fisch1,"bilder\fischrechts1.gif")
    $movex = Random(0, 10, 1)
    Case $fischx > @DesktopWidth - 120
    GUICtrlSetImage($fisch1,"bilder\fischlinks1.gif")
    $movex = Random(-10, 0, 1)
    EndSelect
    Select
    Case $fischy < 0
    $movey = Random(0, 10, 1)
    Case $fischy > @DesktopHeight - 100
    $movey = Random(-10, 0, 1)
    EndSelect
    $fischx = $fischx + $movex
    $fischy = $fischy + $movey
    GUICtrlSetPos($fisch1, $fischx, $fischy)
    EndFunc
    ; ---------------------------------------

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

    ;noch unwichtig-------------------------
    Func _RectCollision($Rect1X1, $Rect1Y1, $Rect1X2, $Rect1Y2, $Rect2X1, $Rect2Y1, $Rect2X2, $Rect2Y2)
    ; Prog@ndy
    Local Const $tagRECT = "long;long;long;long"
    Local $1 = DllStructCreate($tagRECT)
    Local $2 = DllStructCreate($tagRECT)
    Local $3 = DllStructCreate($tagRECT)
    DllStructSetData($1, 1, $Rect1X1)
    DllStructSetData($1, 2, $Rect1Y1)
    DllStructSetData($1, 3, $Rect1X2)
    DllStructSetData($1, 4, $Rect1Y2)
    DllStructSetData($2, 1, $Rect2X1)
    DllStructSetData($2, 2, $Rect2Y1)
    DllStructSetData($2, 3, $Rect2X2)
    DllStructSetData($2, 4, $Rect2Y2)
    Local $r = DllCall("User32.dll", "int", "IntersectRect", "ptr", DllStructGetPtr($3), "ptr", DllStructGetPtr($1), "ptr", DllStructGetPtr($2))
    If @error Then Return SetError(1, 0, 0)
    Return $r[0] <> 0
    EndFunc ;==>_RectCollision

    [/autoit]
  • RectCollison

    • Nathax
    • 16. Dezember 2009 um 17:11

    ja ich hab das wieder geändert sorry ;(

  • RectCollison

    • Nathax
    • 16. Dezember 2009 um 17:10

    wie meinst du das UEZ

  • RectCollison

    • Nathax
    • 16. Dezember 2009 um 17:08

    ok im anhang sind die bilder ich möchte die collision zwischen futter und fisch

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <WindowsConstants.au3>
    #include <StaticConstants.au3>
    #include <Array.au3>
    #Include <Misc.au3>

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

    HotKeySet("{ESC}", "ende")

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

    ; Hauptvariablen-------------------------
    $f = 0
    Global $guix, $guiy
    Global $fischx = 200, $fischy = 300, $movex = 10, $movey = 10
    ; ---------------------------------------

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

    ; Guierstellung--------------------------
    $gui1 = GUICreate ("Aquarium",(@DesktopWidth), (@DesktopHeight-65),0,0)
    GUISetBkColor(0x0000ff,$gui1)
    $hintergrund = GUICtrlCreatepic("bilder\hintergrund.gif",0,0,@DesktopWidth,@DesktopHeight-50)
    $fisch1 = GUICtrlCreatepic("bilder\fischrechts1.gif",$fischx,$fischy, 120,100)
    $futter = GUICtrlCreatePic("bilder\futter.gif",-200,-200,100,100)
    GUISetState (@SW_SHOW)
    ; ---------------------------------------

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

    AdlibEnable("move_fisch", 20)

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

    ; Hauptfunktion des Guis-----------------
    While 1
    $c = GUIGetCursorInfo()
    $f1pos = ControlGetPos( "Aquarium", "", $fisch1)
    $fupos = ControlGetPos( "Aquarium", "", $futter)
    $msg = GUIGetMsg()
    _RectCollision()
    Select
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    EndSelect
    If _IsPressed("01") and $f = 1 Then
    GUICtrlDelete($futter)
    $futter = GUICtrlCreatePic("bilder\futter.gif",$c[0]-40,$c[1]-40,100,100)
    $f = 1
    ElseIf _IsPressed("01") and $f = 0 then
    $futter = GUICtrlCreatePic("bilder\futter.gif",$c[0]-40,$c[1]-40,100,100)
    $f = 1
    Endif

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

    Wend
    ; ---------------------------------------

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

    ; Funktionen-----------------------------
    Func ende()
    Exit
    EndFunc

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

    Func move_fisch()
    Select
    Case $fischx < 0
    GUICtrlSetImage($fisch1,"bilder\fischrechts1.gif")
    $movex = Random(0, 10, 1)
    Case $fischx > @DesktopWidth - 120
    GUICtrlSetImage($fisch1,"bilder\fischlinks1.gif")
    $movex = Random(-10, 0, 1)
    EndSelect
    Select
    Case $fischy < 0
    $movey = Random(0, 10, 1)
    Case $fischy > @DesktopHeight - 100
    $movey = Random(-10, 0, 1)
    EndSelect
    $fischx = $fischx + $movex
    $fischy = $fischy + $movey
    GUICtrlSetPos($fisch1, $fischx, $fischy)
    EndFunc
    ; ---------------------------------------

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

    ;noch unwichtig-------------------------
    Func _RectCollision($f1pos[0], $f1pos[1], $f1pos[0]+200, $f1pos[1]+300, $fupos[0], $fupos[1], $fupos[0]+100, $fupos[1]+100)
    ; Prog@ndy
    Local Const $tagRECT = "long;long;long;long"
    Local $1 = DllStructCreate($tagRECT)
    Local $2 = DllStructCreate($tagRECT)
    Local $3 = DllStructCreate($tagRECT)
    DllStructSetData($1, 1, $f1pos[0])
    DllStructSetData($1, 2, $f1pos[1])
    DllStructSetData($1, 3, $f1pos[0]+200)
    DllStructSetData($1, 4, $f1pos[1]+300)
    DllStructSetData($2, 1, $fupos[0])
    DllStructSetData($2, 2, $fupos[1])
    DllStructSetData($2, 3, $fupos[0]+100)
    DllStructSetData($2, 4, $fupos[1]+100)
    Local $r = DllCall("User32.dll", "int", "IntersectRect", "ptr", DllStructGetPtr($3), "ptr", DllStructGetPtr($1), "ptr", DllStructGetPtr($2))
    If @error Then Return SetError(1, 0, 0)
    Return $r[0] <> 0
    EndFunc ;==>_RectCollision

    [/autoit]
  • RectCollison

    • Nathax
    • 16. Dezember 2009 um 17:03

    geht nicht
    C:\Dokumente und Einstellungen\NATHAN_2\Desktop\Aqua\gfh.au3 (34) : ==> Incorrect number of parameters in function call.:
    _RectCollision()
    ^ ERROR

  • RectCollison

    • Nathax
    • 16. Dezember 2009 um 16:59

    ja

    Spoiler anzeigen

    C:\Dokumente und Einstellungen\NATHAN_2\Desktop\Aqua\gfh.au3 (79) : ==> Badly formatted "Func" statement.:
    Func RectCollision($f1pos[0], $f1pos[1], $f1pos[0]+200, $f1pos[1]+300, $fupos[0], $fupos[1], $fupos[0]+100, $fupos[1]+100)
    Func RectCollision($f1pos^ ERROR


    und ich glaube der hier hat sie geschrieben ist sogar on http://www.autoit.de/index.php?page=User&userID=200143

  • RectCollison

    • Nathax
    • 16. Dezember 2009 um 16:56

    schade die ist offline
    aber könnt ihr euch das ganz vllt nicht erschließen ob ich da noch was angeben muss

  • RectCollison

    • Nathax
    • 16. Dezember 2009 um 16:53

    ja den hab ich leider nicht mehr
    aber warte ich glaube funkey hat ihn mir gegeben.

  • RectCollison

    • Nathax
    • 16. Dezember 2009 um 16:50

    also diese funtion hat ein user hier ins forum gestellt es guckt ob zwei ctrls sich berühren

  • RectCollison

    • Nathax
    • 16. Dezember 2009 um 16:42

    Hie ich habe diese funtkion

    Spoiler anzeigen
    [autoit]

    Func _RectCollision($Rect1X1, $Rect1Y1, $Rect1X2, $Rect1Y2, $Rect2X1, $Rect2Y1, $Rect2X2, $Rect2Y2)
    ; Prog@ndy
    Local Const $tagRECT = "long;long;long;long"
    Local $1 = DllStructCreate($tagRECT)
    Local $2 = DllStructCreate($tagRECT)
    Local $3 = DllStructCreate($tagRECT)
    DllStructSetData($1, 1, $Rect1X1)
    DllStructSetData($1, 2, $Rect1Y1)
    DllStructSetData($1, 3, $Rect1X2)
    DllStructSetData($1, 4, $Rect1Y2)
    DllStructSetData($2, 1, $Rect2X1)
    DllStructSetData($2, 2, $Rect2Y1)
    DllStructSetData($2, 3, $Rect2X2)
    DllStructSetData($2, 4, $Rect2Y2)
    Local $r = DllCall("User32.dll", "int", "IntersectRect", "ptr", DllStructGetPtr($3), "ptr", DllStructGetPtr($1), "ptr", DllStructGetPtr($2))
    If @error Then Return SetError(1, 0, 0)
    Return $r[0] <> 0
    EndFunc ;==>_RectCollision

    [/autoit]

    Mit folgenden werten gefüllt. ich glaube bis jetzt ist noch alles riochtig aber muss ich da noch was ändern??

    Spoiler anzeigen
    [autoit]

    Func _RectCollision($f1pos[0], $f1pos[1], $f1pos[0]+200, $f1pos[1]+300, $fupos[0], $fupos[1], $fupos[0]+100, $fupos[1]+100)
    ; Prog@ndy
    Local Const $tagRECT = "long;long;long;long"
    Local $1 = DllStructCreate($tagRECT)
    Local $2 = DllStructCreate($tagRECT)
    Local $3 = DllStructCreate($tagRECT)
    DllStructSetData($1, 1, $f1pos[0])
    DllStructSetData($1, 2, $f1pos[1])
    DllStructSetData($1, 3, $f1pos[0]+200)
    DllStructSetData($1, 4, $f1pos[1]+300)
    DllStructSetData($2, 1, $fupos[0])
    DllStructSetData($2, 2, $fupos[1])
    DllStructSetData($2, 3, $fupos[0]+100)
    DllStructSetData($2, 4, $fupos[1]+100)
    Local $r = DllCall("User32.dll", "int", "IntersectRect", "ptr", DllStructGetPtr($3), "ptr", DllStructGetPtr($1), "ptr", DllStructGetPtr($2))
    If @error Then Return SetError(1, 0, 0)
    Return $r[0] <> 0
    EndFunc ;==>_RectCollision

    [/autoit]
  • controlmove

    • Nathax
    • 16. Dezember 2009 um 16:02

    cool danke werde ich vllt noch ein bisschen verändern

  • tab wird nicht angezeigt

    • Nathax
    • 16. Dezember 2009 um 15:57

    stell bitte den source rein, dann können wir dir auch helfen ;)

  • controlmove

    • Nathax
    • 15. Dezember 2009 um 19:06

    guck ich mir morgen an bb

  • controlmove

    • Nathax
    • 15. Dezember 2009 um 18:33

    ich möchte halt das der fisch sozusagen im gui schwimmt also dass seine position sich andauernd verändert

  • controlmove

    • Nathax
    • 15. Dezember 2009 um 18:25

    ansonsten kommt ja genau das gleiche problem wie beim fisch

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <WindowsConstants.au3>
    #include <StaticConstants.au3>
    #include <Array.au3>
    #Include <Misc.au3>

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

    HotKeySet("{ESC}", "ende")

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

    ; Hauptvariablen-------------------------
    ; ---------------------------------------

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

    ; Guierstellung--------------------------
    $gui1 = GUICreate ("Aquarium",(@DesktopWidth), (@DesktopHeight-65),0,0)
    GUISetBkColor(0x0000ff,$gui1)
    $hintergrund = GUICtrlCreatepic("bilder\hintergrund.gif",0,0,@DesktopWidth,@DesktopHeight-50)
    $fisch1 = GUICtrlCreatepic("bilder\fisch1.gif",200,300,120,100)
    $futter = GUICtrlCreatepic("bilder\futter.gif",-100,-100,80,80)
    GUISetState (@SW_SHOW)
    ; ---------------------------------------

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

    ; Hauptfunktion des Guis-----------------
    While 1
    $c = GUIGetCursorInfo()
    $f1pos = ControlGetPos ( "Aquarium", "", $fisch1)
    $msg = GUIGetMsg()
    ControlMove("Aquarium", "", $fisch1, $f1pos[0]+1, $f1pos[1]+1)
    Select
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    EndSelect
    If _IsPressed("01") Then
    ControlMove("Aquarium", "", $futter, $c[0]-30, $c[1]-30)
    Endif
    Wend
    ; ---------------------------------------

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

    ; Funktionen-----------------------------
    Func ende()
    Exit
    EndFunc
    ; ---------------------------------------

    [/autoit]
  • controlmove

    • Nathax
    • 15. Dezember 2009 um 18:21

    ka aber kommt doch mal pls zu meinem problem :!:

  • Rechnen mit AutoIt

    • Nathax
    • 15. Dezember 2009 um 16:49

    ich weiß aber besser als gar nicht war ja nur ne eistiegshilfe erkönnte das ja mit buttons auwechseln

  • Rechnen mit AutoIt

    • Nathax
    • 15. Dezember 2009 um 16:42

    oder so

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>

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

    Opt("GUIOnEventMode", 1)
    $window_TR = GUICreate( "Taschenrechner", 170, 260)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Ende")
    GUICtrlCreateLabel("Taschenrechner", 30, 10)

    $rechenart = GUICtrlCreateInput("", 10, 80, 110, 20)
    $inputTR1 = GUICtrlCreateInput("", 10, 10, 110, 20)
    $inputTR2 = GUICtrlCreateInput("", 10, 45, 110, 20)
    $buttonTRlsg = GUICtrlCreateButton ("=", 10, 220, 30, 30)
    $LabelTR1 = GUICtrlCreateLabel("Ergebnis", 56, 230, 55, 18)
    GUICtrlSetOnEvent($buttonTRlsg, "calc")
    GUISetState(@SW_SHOW, $window_TR)

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

    While 1
    Sleep(1000)
    WEnd
    Func calc()
    If GUICtrlRead($rechenart) = "+" then
    $Erg = GUICtrlRead($inputTR1) + GUICtrlRead($inputTR2)
    GUICtrlSetData($LabelTR1, $Erg) ; hier zeigt AutoIt exakt die Eingabe an
    ElseIf GUICtrlRead($rechenart) = "-" then
    $Erg = GUICtrlRead($inputTR1) - GUICtrlRead($inputTR2)
    GUICtrlSetData($LabelTR1, $Erg) ; hier zeigt AutoIt exakt die Eingabe an
    EndIf
    EndFunc
    Func Ende()
    Exit
    EndFunc

    [/autoit]


    ganz oben die erste darunter die zweite zahl und ganz unten rechenart bis jetzt nur + oder -

  • controlmove

    • Nathax
    • 15. Dezember 2009 um 16:06

    Hi habt ihr ne idee wie man den fisch bewegen könnte
    wie man sieht klappt es, aber nur sehr verbuggt.
    Hier die pics:
    Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.
    Hier der code:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <WindowsConstants.au3>
    #include <StaticConstants.au3>
    #include <Array.au3>
    #Include <Misc.au3>

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

    HotKeySet("{ESC}", "ende")

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

    ; Hauptvariablen-------------------------
    $f = 0
    ; ---------------------------------------

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

    ; Guierstellung--------------------------
    $gui1 = GUICreate ("Aquarium",(@DesktopWidth), (@DesktopHeight-65),0,0)
    GUISetBkColor(0x0000ff,$gui1)
    $hintergrund = GUICtrlCreatepic("bilder\hintergrund.gif",0,0,@DesktopWidth,@DesktopHeight-50)
    $fisch1 = GUICtrlCreatepic("bilder\fisch1.gif",200,300,120,100)
    GUISetState (@SW_SHOW)
    ; ---------------------------------------

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

    ; Hauptfunktion des Guis-----------------
    While 1
    $c = GUIGetCursorInfo()
    $f1pos = ControlGetPos ( "Aquarium", "", $fisch1)
    $msg = GUIGetMsg()
    ControlMove("Aquarium", "", $fisch1, $f1pos[0]+1, $f1pos[1]+1)
    Select
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    EndSelect
    If _IsPressed("01") and $f = 1 Then
    GUICtrlDelete($futter)
    $futter = GUICtrlCreatePic("bilder\futter.gif",$c[0]-40,$c[1]-40,100,100)
    $f = 1
    ElseIf _IsPressed("01") and $f = 0 then
    $futter = GUICtrlCreatePic("bilder\futter.gif",$c[0]-40,$c[1]-40,100,100)
    $f = 1
    Endif
    Wend
    ; ---------------------------------------

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

    ; Funktionen-----------------------------
    Func ende()
    Exit
    EndFunc
    ; ---------------------------------------

    [/autoit]

    Dateien

    Aqua.rar 25,59 kB – 217 Downloads
  • Transparenz

    • Nathax
    • 14. Dezember 2009 um 17:39

    jo sehr thx leute

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™