PHP Code:
#include <Array.au3>
#include <GDIPlus.au3>
#include <Misc.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
_GDIPlus_Startup()
$hGUI=GuiCreate("Spiel", 200, 200, @DesktopWidth*0.3, @DesktopHeight*0.3, $WS_POPUP)
GUISetState(@SW_SHOW, $hGUI)
$hGUI2=GuiCreate("Punkte", 200, 50, @DesktopWidth*0.3, @DesktopHeight*0.3+210, $WS_POPUP)
GUISetBkColor(0x20B2AA, $hGUI2)
GUICtrlCreateLabel("Punkte:", 50, 20, 50, 17)
$points_label=GUICtrlCreateLabel("0", 120, 20, 20, 20)
GUISetState(@SW_SHOW, $hGUI2)
$hGraphic=_GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBrush1=_GDIPlus_BrushCreateSolid(0xFFFF0000)
$hBrush2=_GDIPlus_BrushCreateSolid(0xFF20B2AA)
$hBrush3=_GDIPlus_BrushCreateSolid(0xFF228B22)
Global $pos[2]
$pos[0]=0
$pos[1]=0
Global $pos_punkt[2]
$pos_punkt[0]=Round(Random(10, 190, 1), -1)
$pos_punkt[1]=Round(Random(10, 190, 1), -1)
Global $points=0
GUISetOnEvent(-3, "_Exit")
GUIRegisterMsg($WM_PAINT, "WM_PAINT")
$timer=TimerInit()
While 1
seek()
Select
Case _IsPressed(25)
$pos[0]-=10
Case _IsPressed(26)
$pos[1]-=10
Case _IsPressed(27)
$pos[0]+=10
Case _IsPressed(28)
$pos[1]+=10
EndSelect
draw()
Select
Case $pos[0]>190
$pos[0]=0
Case $pos[0]<0
$pos[0]=190
Case $pos[1]>190
$pos[1]=0
Case $pos[1]<0
$pos[1]=190
EndSelect
Sleep(75)
WEnd
Func seek()
If $pos[0]=$pos_punkt[0] AND $pos[1]=$pos_punkt[1] Then
$points+=1
Sleep(25)
GUICtrlSetData($points_label, $points)
If $points=10 Then
MsgBox(0, "Game Over", "Deine Zeit ist: " & Round(TimerDiff($timer)/1000, 0) & " Sekunden!")
_Exit()
EndIf
$pos_punkt[0]=Round(Random(10, 190, 1), -1)
$pos_punkt[1]=Round(Random(10, 190, 1), -1)
EndIf
EndFunc
Func draw()
_GDIPlus_GraphicsClear($hGraphic,0xFFF0F0F0)
_GDIPlus_GraphicsFillRect($hGraphic, 0, 0, 200, 200, $hBrush2)
_GDIPlus_GraphicsFillRect($hGraphic, $pos_punkt[0], $pos_punkt[1], 10, 10, $hBrush3)
_GDIPlus_GraphicsFillRect($hGraphic, $pos[0], $pos[1], 10, 10, $hBrush1)
EndFunc
Func WM_PAINT()
draw()
EndFunc
Func _Exit()
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_BrushDispose($hBrush1)
_GDIPlus_BrushDispose($hBrush2)
_GDIPlus_Shutdown()
Exit
EndFunc