Figur Mit Pfeiltasten steuern

  • So hier ist jetzt mein akt. Script. Steuerung vom PacMan funzt. Nur ich hab noch ein Problem mit dem Hintergrund, dieser soll später die Gänge darstehen, wo man mit dem PacMan langgehen kann.
    Siehe Zeile 96, siehe Kommi.

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <GDIPlus.au3>
    #include <GUIConstants.au3>
    #include <Misc.au3>

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

    Global $Timer
    Global $iWidth = 600
    Global $iHeight = 600
    Global $iX = 100
    Global $iY = 100
    Global $iAngleStart = 20
    Global $iAngleEnd = 320
    Global $piewidth = 0
    Global $pieheight = 320

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

    Global $aBG[12][12] = [[1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0], _
    [0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], _
    [0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], _
    [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1], _
    [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1], _
    [1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0], _
    [1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1], _
    [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1], _
    [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1], _
    [1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0], _
    [1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0], _
    [1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1]]

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

    $hDLL = DllOpen("user32.dll")

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

    $hGui = GUICreate("Test", $iWidth, $iHeight)
    $hHwndGui = WinGetHandle($hGui)
    GUISetState()

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

    _GDIPlus_Startup ()

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

    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hHwndGui)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)
    $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)
    $pac = _GDIPlus_BrushCreateSolid(0xFFFFFF00)
    $Brush1 = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    $Brush2 = _GDIPlus_BrushCreateSolid(0xFF000000)
    _BG()

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

    AdlibRegister("_AniPacMan", 400)

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

    While 1
    If TimerDiff($Timer) > 200 Then _Draw(1)

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

    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    _Exit()
    EndSwitch

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

    Select
    Case _IsPressed("25", $hDLL) ;links
    $iAngleStart = 200
    $iX -= 5
    _Draw()
    Case _IsPressed("26", $hDLL) ;oben
    $iAngleStart = 290
    $iY -= 5
    _Draw()
    Case _IsPressed("27", $hDLL) ;rechts
    $iAngleStart = 20
    $iX += 5
    _Draw()
    Case _IsPressed("28", $hDLL) ;unten
    $iAngleStart = 110
    $iY += 5
    _Draw()
    EndSelect
    WEnd

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

    Func _Draw($iTyp = 0)
    Local $Exit
    _GDIPlus_GraphicsClear($hBuffer)
    Do
    Switch $iTyp
    Case 0
    If TimerDiff($Timer) > 200 Then
    $iTyp = 1
    Else
    $iTyp = 2
    EndIf
    Case 1
    _GDIPlus_GraphicsFillPie($hBuffer, $iX, $iY, 50, 50, $iAngleStart, $iAngleEnd, $pac)
    $Exit = 1
    Case 2
    _GDIPlus_GraphicsFillPie($hBuffer, $iX, $iY, 50, 50, $iAngleStart - 15, $iAngleEnd + 30, $pac)
    $Exit = 1
    EndSwitch
    Until $Exit
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $iWidth, $iHeight) ; Wenn ich dies rausnehme, seh ich zwar den Hintergrund aber nicht den PacMan.
    ; Wenn ich den drinlasse seh ich PacMan aber nicht den Hintergund.
    EndFunc

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

    Func _Exit()
    _GDIPlus_BrushDispose($pac)
    _GDIPlus_BrushDispose($Brush1)
    _GDIPlus_BrushDispose($Brush2)
    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    DllClose($hDLL)
    Exit
    EndFunc

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

    Func _AniPacMan()
    _Draw(2)
    $Timer = TimerInit()
    EndFunc

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

    Func _BG()
    For $y = 0 To UBound($aBG) - 1
    For $x = 0 To UBound($aBG, 2) - 1
    If $aBG[$y][$x] Then
    _GDIPlus_GraphicsFillRect($hGraphics, $x * 50, $y * 50, 50, 50, $Brush1)
    Else
    _GDIPlus_GraphicsFillRect($hGraphics, $x * 50, $y * 50, 50, 50, $Brush2)
    EndIf
    Next
    Next
    EndFunc

    [/autoit]
  • da kann man an einer stelle raugehen und auf der anderen seite wieder reingehen.
    mal ne andere frage

    die ghost von pacman kann ich die computergesteuert laufen lassen oder geht das net?

  • Aso das meinst du ich dachte du meinst überall. Hast dir denn mein Script mal angesehen? Man könnte die mit Random irgendwie sagen wo sie langegehn sollen, aber damit befasse ich mich später. jetzt gehts erstmal darum, dass man den Hintergrund und PacMan sieht, danach mach ich dann das man nur in den Gängen gehen kann.

    Edit:
    So habs hinbekommen mit Hilfe von UEZ.

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <GDIPlus.au3>
    #include <GUIConstants.au3>
    #include <Misc.au3>

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

    Opt("GUIOnEventMode", 1)

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

    Global $Timer
    Global $iWidth = 600
    Global $iHeight = 600
    Global $iX = 100
    Global $iY = 100
    Global $iAngleStart = 20
    Global $iAngleEnd = 320
    Global $piewidth = 0
    Global $pieheight = 320

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

    Global $aBG[12][12] = [[1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0], _
    [0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], _
    [0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], _
    [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1], _
    [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1], _
    [1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0], _
    [1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1], _
    [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1], _
    [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1], _
    [1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0], _
    [1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0], _
    [1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1]]

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

    $hDLL = DllOpen("user32.dll")

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

    $hGui = GUICreate("Test", $iWidth, $iHeight)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetState()

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

    _GDIPlus_Startup ()

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

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
    $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)

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

    $pac = _GDIPlus_BrushCreateSolid(0xFFFFFF00)
    $Brush1 = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    $Brush2 = _GDIPlus_BrushCreateSolid(0xFF000000)
    _BG()

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

    AdlibRegister("_AniPacMan", 400)

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

    While 1
    If TimerDiff($Timer) > 200 Then _Draw(1)

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

    Select
    Case _IsPressed("25", $hDLL) ;links
    $iAngleStart = 200
    $iX -= 10
    _Draw()
    Case _IsPressed("26", $hDLL) ;oben
    $iAngleStart = 290
    $iY -= 10
    _Draw()
    Case _IsPressed("27", $hDLL) ;rechts
    $iAngleStart = 20
    $iX += 10
    _Draw()
    Case _IsPressed("28", $hDLL) ;unten
    $iAngleStart = 110
    $iY += 10
    _Draw()
    EndSelect
    WEnd

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

    Func _Draw($iTyp = 0)
    _BG()
    While 1
    Switch $iTyp
    Case 0
    $iTyp = _Iif(TimerDiff($Timer) > 200, 1, 2)
    Case 1
    _GDIPlus_GraphicsFillPie($hBuffer, $iX, $iY, 50, 50, $iAngleStart, $iAngleEnd, $pac)
    ExitLoop
    Case 2
    _GDIPlus_GraphicsFillPie($hBuffer, $iX, $iY, 50, 50, $iAngleStart - 15, $iAngleEnd + 30, $pac)
    ExitLoop
    EndSwitch
    WEnd
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iWidth, $iHeight)
    EndFunc

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

    Func _Exit()
    _GDIPlus_BrushDispose($pac)
    _GDIPlus_BrushDispose($Brush1)
    _GDIPlus_BrushDispose($Brush2)
    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    DllClose($hDLL)
    Exit
    EndFunc

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

    Func _AniPacMan()
    _Draw(2)
    $Timer = TimerInit()
    EndFunc

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

    Func _BG()
    For $y = 0 To UBound($aBG) - 1
    For $x = 0 To UBound($aBG, 2) - 1
    If $aBG[$y][$x] Then
    _GDIPlus_GraphicsFillRect($hBuffer, $x * 50, $y * 50, 50, 50, $Brush1)
    Else
    _GDIPlus_GraphicsFillRect($hBuffer, $x * 50, $y * 50, 50, 50, $Brush2)
    EndIf
    Next
    Next
    EndFunc

    [/autoit]

    Nun ist es ja so, dass wenn _Draw aufgerufen wird auch _BG aufegrufen wird. Dadurch kommt es zum stocken. Wie kann ich denn nun _Draw aufrufen ohne das ich immer den Hintergrund auch mit aufbauen lassen muss? Habs schon probiert und habe _BG am Anfang schon aufgerufen und hab dann per ImageSaveToFile, als JPG abgespeichert und dann per ImageLoadFromFile wieder geladen und habe dann in der _Draw mit GraphicsDrawImage den Hintergrund immer gezeichnet. Dann hats auch nicht mehr gestockt, aber das ist mir zu umständlich extra noch eine Datei anzulegen. Wie gehts (kürzer und) einfacher?

    Einmal editiert, zuletzt von m-obi (23. April 2010 um 15:31)

  • So meins sieht jetzt so aus:

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <GDIPlus.au3>
    #include <GUIConstants.au3>
    #include <Misc.au3>

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

    Opt("GUIOnEventMode", 1)

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

    Global $aEnableForGo[4] ; [links, oben, rechts, unten]
    Global $Timer
    Global $iWidth = 600
    Global $iHeight = 600
    Global $iX = 0
    Global $iY = 0
    Global $iAngleStart = 20
    Global $iAngleEnd = 320
    Global $piewidth = 0
    Global $pieheight = 320
    Global $aSquarePos[2]
    Global $aBG[12][12] = [[1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0], _
    [0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], _
    [0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], _
    [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1], _
    [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1], _
    [1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0], _
    [1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1], _
    [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1], _
    [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1], _
    [1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0], _
    [1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0], _
    [1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1]]

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

    $hDLL = DllOpen("user32.dll")

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

    $hGui = GUICreate("PacMan made by m-obi", $iWidth, $iHeight)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetState()

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

    _GDIPlus_Startup ()

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

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
    $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)

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

    $pac = _GDIPlus_BrushCreateSolid(0xFFFFFF00)
    $Brush1 = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    $Brush2 = _GDIPlus_BrushCreateSolid(0xFF000000)
    _BG()

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

    AdlibRegister("_AniPacMan", 400)
    AdlibRegister("_SquarePos", 50)

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

    While 1
    If TimerDiff($Timer) > 200 Then _Draw(1)

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

    $aEnableForGo[0] = _Iif($aSquarePos[0] = 0.5, 0, 1)
    $aEnableForGo[1] = _Iif($aSquarePos[1] = 0.5, 0, 1)
    $aEnableForGo[2] = _Iif($aSquarePos[0] = 11.5, 0, 1)
    $aEnableForGo[3] = _Iif($aSquarePos[1] = 11.5, 0, 1)

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

    If StringRight($aSquarePos[0], 1) = 5 Then
    Select
    Case _IsPressed("26", $hDLL) And $aEnableForGo[1] ;oben
    $iAngleStart = 290
    $iY -= 10
    _Draw()
    Case _IsPressed("28", $hDLL) And $aEnableForGo[3] ;unten
    $iAngleStart = 110
    $iY += 10
    _Draw()
    EndSelect
    EndIf

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

    If StringRight($aSquarePos[1], 1) = 5 Then
    Select
    Case _IsPressed("25", $hDLL) And $aEnableForGo[0] ;links
    $iAngleStart = 200
    $iX -= 10
    _Draw()
    Case _IsPressed("27", $hDLL) And $aEnableForGo[2] ;rechts
    $iAngleStart = 20
    $iX += 10
    _Draw()
    EndSelect
    EndIf
    WEnd

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

    Func _Draw($iTyp = 0)
    _BG()
    While 1
    Switch $iTyp
    Case 0
    $iTyp = _Iif(TimerDiff($Timer) > 200, 1, 2)
    Case 1
    _GDIPlus_GraphicsFillPie($hBuffer, $iX, $iY, 50, 50, $iAngleStart, $iAngleEnd, $pac)
    ExitLoop
    Case 2
    _GDIPlus_GraphicsFillPie($hBuffer, $iX, $iY, 50, 50, $iAngleStart - 15, $iAngleEnd + 30, $pac)
    ExitLoop
    EndSwitch
    WEnd
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iWidth, $iHeight)
    EndFunc

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

    Func _Exit()
    _GDIPlus_BrushDispose($pac)
    _GDIPlus_BrushDispose($Brush1)
    _GDIPlus_BrushDispose($Brush2)
    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    DllClose($hDLL)
    Exit
    EndFunc

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

    Func _AniPacMan()
    _Draw(2)
    $Timer = TimerInit()
    EndFunc

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

    Func _BG()
    For $y = 0 To UBound($aBG) - 1
    For $x = 0 To UBound($aBG, 2) - 1
    If $aBG[$y][$x] Then
    _GDIPlus_GraphicsFillRect($hBuffer, $x * 50, $y * 50, 50, 50, $Brush1)
    Else
    _GDIPlus_GraphicsFillRect($hBuffer, $x * 50, $y * 50, 50, 50, $Brush2)
    EndIf
    Next
    Next
    EndFunc

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

    Func _SquarePos()
    $aSquarePos[0] = ($iX / 50) + 0.5
    $aSquarePos[1] = ($iY / 50) + 0.5
    EndFunc

    [/autoit]

    Nun bleibt der PacMan innerhalb der Gui und verschwindet nicht mehr am Rand und wenn man ihn steuert bleibt er immer auf den Kacheln (50 x 50 Pixel). D.h. immer wenn er komplett auf einer Kachel ist kann man ihn in die jeweilige Richtung steuern. Bisher konnte man ihn immer nach links, oben, rechts oder unten steuern, so das er auch auf vier Kacheln war, also z.B. war er auf einer Ecke, siehe Bilder.
    autoit.de/wcf/attachment/9162/

    und so wie es nun ist:
    autoit.de/wcf/attachment/9163/


    Mit der Geschwindigkeit, dass er nicht so stockt immer, kommt noch, siehe mein voriger Post. Als nächstes nehme ich mir vor, dass er nur in den Gängen gehen darf.

  • wie soll das denn mit random funktionieren??

    kann ich irgendwie bilder bewegen lassen, wegen den ghosts??

    oder kann man die irgendwie mit gdi+ zeichnen lassen??


    @m-obi es gibt ein problem bei dein pacman wenn man zur seite gedrückt hält oder eine andere taste läuft er durch das schwarze.

  • ok ich nehms zurück :P

    also wie kann ich bilder sich bewegen lassen oder geht das net??

  • Soooo nun geht er nur in den Gängen. Mal sehen was ich alles nächstes mache.

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <GDIPlus.au3>
    #include <GUIConstants.au3>
    #include <Misc.au3>

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

    Opt("GUIOnEventMode", 1)

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

    Global $aEnableForGo[4] ; [links, oben, rechts, unten]
    Global $Timer
    Global $iWidth = 600
    Global $iHeight = 600
    Global $iX = 500
    Global $iY = 200
    Global $iAngleStart = 20
    Global $iAngleEnd = 320
    Global $piewidth = 0
    Global $pieheight = 320
    Global $aSquarePos[2]
    Global $aBG[12][12] = [[1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0], _
    [0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], _
    [0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], _
    [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1], _
    [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1], _
    [1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0], _
    [1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1], _
    [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1], _
    [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1], _
    [1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0], _
    [1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0], _
    [1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1]]

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

    $hDLL = DllOpen("user32.dll")

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

    $hGui = GUICreate("PacMan made by m-obi", $iWidth, $iHeight)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetState()

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

    _GDIPlus_Startup ()

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

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
    $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)

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

    $pac = _GDIPlus_BrushCreateSolid(0xFFFFFF00)
    $Brush1 = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    $Brush2 = _GDIPlus_BrushCreateSolid(0xFF000000)
    _BG()

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

    AdlibRegister("_AniPacMan", 400)
    AdlibRegister("_SquarePos", 50)

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

    While 1
    If TimerDiff($Timer) > 200 Then _Draw(1)

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

    ;ToolTip($aSquarePos[0] & @CRLF & $aSquarePos[1])

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

    If $aSquarePos[0] > 0.9 Then $aEnableForGo[0] = $aBG[Int($aSquarePos[1])][Int($aSquarePos[0]) - 1]
    If $aSquarePos[1] > 0.9 Then $aEnableForGo[1] = $aBG[Int($aSquarePos[1]) - 1][Int($aSquarePos[0])]
    If $aSquarePos[0] < 11 Then $aEnableForGo[2] = $aBG[Int($aSquarePos[1])][Int($aSquarePos[0]) + 1]
    If $aSquarePos[1] < 11 Then $aEnableForGo[3] = $aBG[Int($aSquarePos[1]) + 1][Int($aSquarePos[0])]

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

    $aEnableForGo[0] = _Iif($aSquarePos[0] = 0.5 Or (Not $aEnableForGo[0] And StringRight($aSquarePos[0], 1) = 5), 0, 1)
    $aEnableForGo[1] = _Iif($aSquarePos[1] = 0.5 Or (Not $aEnableForGo[1] And StringRight($aSquarePos[1], 1) = 5), 0, 1)
    $aEnableForGo[2] = _Iif($aSquarePos[0] = 11.5 Or (Not $aEnableForGo[2] And StringRight($aSquarePos[0], 1) = 5), 0, 1)
    $aEnableForGo[3] = _Iif($aSquarePos[1] = 11.5 Or (Not $aEnableForGo[3] And StringRight($aSquarePos[1], 1) = 5), 0, 1)

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

    If StringRight($aSquarePos[0], 1) = 5 Then
    Select
    Case _IsPressed("26", $hDLL) And $aEnableForGo[1] ;oben
    $iAngleStart = 290
    $iY -= 10
    _Draw()
    Case _IsPressed("28", $hDLL) And $aEnableForGo[3] ;unten
    $iAngleStart = 110
    $iY += 10
    _Draw()
    EndSelect
    EndIf

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

    If StringRight($aSquarePos[1], 1) = 5 Then
    Select
    Case _IsPressed("25", $hDLL) And $aEnableForGo[0] ;links
    $iAngleStart = 200
    $iX -= 10
    _Draw()
    Case _IsPressed("27", $hDLL) And $aEnableForGo[2] ;rechts
    $iAngleStart = 20
    $iX += 10
    _Draw()
    EndSelect
    EndIf
    WEnd

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

    Func _Draw($iTyp = 0)
    _BG()
    While 1
    Switch $iTyp
    Case 0
    $iTyp = _Iif(TimerDiff($Timer) > 200, 1, 2)
    Case 1
    _GDIPlus_GraphicsFillPie($hBuffer, $iX, $iY, 50, 50, $iAngleStart, $iAngleEnd, $pac)
    ExitLoop
    Case 2
    _GDIPlus_GraphicsFillPie($hBuffer, $iX, $iY, 50, 50, $iAngleStart - 15, $iAngleEnd + 30, $pac)
    ExitLoop
    EndSwitch
    WEnd
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iWidth, $iHeight)
    EndFunc

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

    Func _Exit()
    _GDIPlus_BrushDispose($pac)
    _GDIPlus_BrushDispose($Brush1)
    _GDIPlus_BrushDispose($Brush2)
    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    DllClose($hDLL)
    Exit
    EndFunc

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

    Func _AniPacMan()
    _Draw(2)
    $Timer = TimerInit()
    EndFunc

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

    Func _BG()
    For $y = 0 To UBound($aBG) - 1
    For $x = 0 To UBound($aBG, 2) - 1
    If $aBG[$y][$x] Then
    _GDIPlus_GraphicsFillRect($hBuffer, $x * 50, $y * 50, 50, 50, $Brush1)
    Else
    _GDIPlus_GraphicsFillRect($hBuffer, $x * 50, $y * 50, 50, 50, $Brush2)
    EndIf
    Next
    Next
    EndFunc

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

    Func _SquarePos()
    $aSquarePos[0] = ($iX / 50) + 0.5
    $aSquarePos[1] = ($iY / 50) + 0.5
    EndFunc

    [/autoit]