@crocojunk
Sag mal hast du vor etwas zu lernen?
Figur Mit Pfeiltasten steuern
-
- [ offen ]
-
crocojunk -
20. April 2010 um 14:58 -
Geschlossen -
Erledigt
-
-
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>
[/autoit] [autoit][/autoit] [autoit]
#include <GDIPlus.au3>
#include <GUIConstants.au3>
#include <Misc.au3>Global $Timer
[/autoit] [autoit][/autoit] [autoit]
Global $iWidth = 600
Global $iHeight = 600
Global $iX = 100
Global $iY = 100
Global $iAngleStart = 20
Global $iAngleEnd = 320
Global $piewidth = 0
Global $pieheight = 320Global $aBG[12][12] = [[1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0], _
[/autoit] [autoit][/autoit] [autoit]
[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]]$hDLL = DllOpen("user32.dll")
[/autoit] [autoit][/autoit] [autoit]$hGui = GUICreate("Test", $iWidth, $iHeight)
[/autoit] [autoit][/autoit] [autoit]
$hHwndGui = WinGetHandle($hGui)
GUISetState()_GDIPlus_Startup ()
[/autoit] [autoit][/autoit] [autoit]$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hHwndGui)
[/autoit] [autoit][/autoit] [autoit]
$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()AdlibRegister("_AniPacMan", 400)
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit] [autoit][/autoit] [autoit]
If TimerDiff($Timer) > 200 Then _Draw(1)$nMsg = GUIGetMsg()
[/autoit] [autoit][/autoit] [autoit]
Switch $nMsg
Case $GUI_EVENT_CLOSE
_Exit()
EndSwitchSelect
[/autoit] [autoit][/autoit] [autoit]
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
WEndFunc _Draw($iTyp = 0)
[/autoit] [autoit][/autoit] [autoit]
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.
EndFuncFunc _Exit()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_BrushDispose($pac)
_GDIPlus_BrushDispose($Brush1)
_GDIPlus_BrushDispose($Brush2)
_GDIPlus_GraphicsDispose($hBuffer)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
DllClose($hDLL)
Exit
EndFuncFunc _AniPacMan()
[/autoit] [autoit][/autoit] [autoit]
_Draw(2)
$Timer = TimerInit()
EndFuncFunc _BG()
[/autoit]
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 -
name22 ja ich möchte was lernen.
@m-obi also das pacman das ich gesehen habe , da konnte man das http://www.alexo.org/onlinespiele/pacman.php
EDIT\\ Kennt einer seite wo ich speziele Icons bekomme. Danke
-
erstell doch eigene icons mit IcoFX
-
oder https://autoit.de/www.iconfinder.com
is zwar englisch aber egalEdit\\ Ok die pacman sachen sind irgendwie doof dort
-
name22 ja ich möchte was lernen.
@m-obi also das pacman das ich gesehen habe , da konnte man das http://www.alexo.org/onlinespiele/pacman.php
EDIT\\ Kennt einer seite wo ich speziele Icons bekomme. Danke
@m-obi also das pacman das ich gesehen habe , da konnte man das http://www.alexo.org/onlinespiele/pacman.php
Was konnte man da?
Such doch einfach bei Google unter "free icons", da wirst du mit Sicherheit was finden.
-
da kann man an einer stelle raugehen und auf der anderen seite wieder reingehen.
mal ne andere fragedie 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>
[/autoit] [autoit][/autoit] [autoit]
#include <GDIPlus.au3>
#include <GUIConstants.au3>
#include <Misc.au3>Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global $Timer
[/autoit] [autoit][/autoit] [autoit]
Global $iWidth = 600
Global $iHeight = 600
Global $iX = 100
Global $iY = 100
Global $iAngleStart = 20
Global $iAngleEnd = 320
Global $piewidth = 0
Global $pieheight = 320Global $aBG[12][12] = [[1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0], _
[/autoit] [autoit][/autoit] [autoit]
[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]]$hDLL = DllOpen("user32.dll")
[/autoit] [autoit][/autoit] [autoit]$hGui = GUICreate("Test", $iWidth, $iHeight)
[/autoit] [autoit][/autoit] [autoit]
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GUISetState()_GDIPlus_Startup ()
[/autoit] [autoit][/autoit] [autoit]$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
[/autoit] [autoit][/autoit] [autoit]
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
$hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)$pac = _GDIPlus_BrushCreateSolid(0xFFFFFF00)
[/autoit] [autoit][/autoit] [autoit]
$Brush1 = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
$Brush2 = _GDIPlus_BrushCreateSolid(0xFF000000)
_BG()AdlibRegister("_AniPacMan", 400)
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit] [autoit][/autoit] [autoit]
If TimerDiff($Timer) > 200 Then _Draw(1)Select
[/autoit] [autoit][/autoit] [autoit]
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
WEndFunc _Draw($iTyp = 0)
[/autoit] [autoit][/autoit] [autoit]
_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)
EndFuncFunc _Exit()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_BrushDispose($pac)
_GDIPlus_BrushDispose($Brush1)
_GDIPlus_BrushDispose($Brush2)
_GDIPlus_GraphicsDispose($hBuffer)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
DllClose($hDLL)
Exit
EndFuncFunc _AniPacMan()
[/autoit] [autoit][/autoit] [autoit]
_Draw(2)
$Timer = TimerInit()
EndFuncFunc _BG()
[/autoit]
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
EndFuncNun 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?
-
So meins sieht jetzt so aus:
Spoiler anzeigen
[autoit]#include <Array.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GDIPlus.au3>
#include <GUIConstants.au3>
#include <Misc.au3>Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global $aEnableForGo[4] ; [links, oben, rechts, unten]
[/autoit] [autoit][/autoit] [autoit]
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]]$hDLL = DllOpen("user32.dll")
[/autoit] [autoit][/autoit] [autoit]$hGui = GUICreate("PacMan made by m-obi", $iWidth, $iHeight)
[/autoit] [autoit][/autoit] [autoit]
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GUISetState()_GDIPlus_Startup ()
[/autoit] [autoit][/autoit] [autoit]$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
[/autoit] [autoit][/autoit] [autoit]
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
$hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)$pac = _GDIPlus_BrushCreateSolid(0xFFFFFF00)
[/autoit] [autoit][/autoit] [autoit]
$Brush1 = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
$Brush2 = _GDIPlus_BrushCreateSolid(0xFF000000)
_BG()AdlibRegister("_AniPacMan", 400)
[/autoit] [autoit][/autoit] [autoit]
AdlibRegister("_SquarePos", 50)While 1
[/autoit] [autoit][/autoit] [autoit]
If TimerDiff($Timer) > 200 Then _Draw(1)$aEnableForGo[0] = _Iif($aSquarePos[0] = 0.5, 0, 1)
[/autoit] [autoit][/autoit] [autoit]
$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)If StringRight($aSquarePos[0], 1) = 5 Then
[/autoit] [autoit][/autoit] [autoit]
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
EndIfIf StringRight($aSquarePos[1], 1) = 5 Then
[/autoit] [autoit][/autoit] [autoit]
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
WEndFunc _Draw($iTyp = 0)
[/autoit] [autoit][/autoit] [autoit]
_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)
EndFuncFunc _Exit()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_BrushDispose($pac)
_GDIPlus_BrushDispose($Brush1)
_GDIPlus_BrushDispose($Brush2)
_GDIPlus_GraphicsDispose($hBuffer)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
DllClose($hDLL)
Exit
EndFuncFunc _AniPacMan()
[/autoit] [autoit][/autoit] [autoit]
_Draw(2)
$Timer = TimerInit()
EndFuncFunc _BG()
[/autoit] [autoit][/autoit] [autoit]
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
EndFuncFunc _SquarePos()
[/autoit]
$aSquarePos[0] = ($iX / 50) + 0.5
$aSquarePos[1] = ($iY / 50) + 0.5
EndFuncNun 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.
-
Sie mal meinen letzten Satz in meinem letzten Post ;).
-
ok ich nehms zurück
also wie kann ich bilder sich bewegen lassen oder geht das net??
-
Zitat
also wie kann ich bilder sich bewegen lassen oder geht das net??
.......
Doch, siehe z.B. Doodle Jump.
Zeichne statt einem Kreis o.Ä. einfach das mit _GDIPlus_ImageLoadFromFile geladene Bild. -
Soooo nun geht er nur in den Gängen. Mal sehen was ich alles nächstes mache.
Spoiler anzeigen
[autoit]#include <Array.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GDIPlus.au3>
#include <GUIConstants.au3>
#include <Misc.au3>Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global $aEnableForGo[4] ; [links, oben, rechts, unten]
[/autoit] [autoit][/autoit] [autoit]
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]]$hDLL = DllOpen("user32.dll")
[/autoit] [autoit][/autoit] [autoit]$hGui = GUICreate("PacMan made by m-obi", $iWidth, $iHeight)
[/autoit] [autoit][/autoit] [autoit]
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GUISetState()_GDIPlus_Startup ()
[/autoit] [autoit][/autoit] [autoit]$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
[/autoit] [autoit][/autoit] [autoit]
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
$hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)$pac = _GDIPlus_BrushCreateSolid(0xFFFFFF00)
[/autoit] [autoit][/autoit] [autoit]
$Brush1 = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
$Brush2 = _GDIPlus_BrushCreateSolid(0xFF000000)
_BG()AdlibRegister("_AniPacMan", 400)
[/autoit] [autoit][/autoit] [autoit]
AdlibRegister("_SquarePos", 50)While 1
[/autoit] [autoit][/autoit] [autoit]
If TimerDiff($Timer) > 200 Then _Draw(1);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]
[/autoit] [autoit][/autoit] [autoit]
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])]$aEnableForGo[0] = _Iif($aSquarePos[0] = 0.5 Or (Not $aEnableForGo[0] And StringRight($aSquarePos[0], 1) = 5), 0, 1)
[/autoit] [autoit][/autoit] [autoit]
$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)If StringRight($aSquarePos[0], 1) = 5 Then
[/autoit] [autoit][/autoit] [autoit]
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
EndIfIf StringRight($aSquarePos[1], 1) = 5 Then
[/autoit] [autoit][/autoit] [autoit]
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
WEndFunc _Draw($iTyp = 0)
[/autoit] [autoit][/autoit] [autoit]
_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)
EndFuncFunc _Exit()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_BrushDispose($pac)
_GDIPlus_BrushDispose($Brush1)
_GDIPlus_BrushDispose($Brush2)
_GDIPlus_GraphicsDispose($hBuffer)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
DllClose($hDLL)
Exit
EndFuncFunc _AniPacMan()
[/autoit] [autoit][/autoit] [autoit]
_Draw(2)
$Timer = TimerInit()
EndFuncFunc _BG()
[/autoit] [autoit][/autoit] [autoit]
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
EndFuncFunc _SquarePos()
[/autoit]
$aSquarePos[0] = ($iX / 50) + 0.5
$aSquarePos[1] = ($iY / 50) + 0.5
EndFunc -