Ich wollte mal ein simples, kleines Spielchen basteln. Es läuft auch schon, nur spielen kann man nicht ...
Hier mal der Code dafür:
Spoiler anzeigen
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("Form1", 793, 574, 193, 143)
$bSTART = GUICtrlCreateButton("Start", 688, 552, 97, 17, 0)
;$BG = GUICtrlCreatePic(@ScriptDir & "\images\cf01.jpg", 8, 8, 776, 537)
$x = Random(24, 736, 1)
$y = Random(24, 516, 1)
;$bPic = GUICtrlCreatePic(@ScriptDir & "\orange.gif", $x, $y, 32, 32)
$bPic = GUICtrlCreateButton("",$x, $y, 32, 32)
GUICtrlSetState($bPic,$GUI_HIDE)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Close")
GUICtrlSetOnEvent($bSTART, "_Start")
GUICtrlSetOnEvent($bPic, "_Pic")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(1000)
WEnd
;Functions
Func _Start()
GUICtrlSetState($bPic,$GUI_SHOW)
For $i = 1 To 10
$x = Random(24, 736, 1)
$y = Random(24, 516, 1)
Sleep(2000)
GUICtrlSetPos($bPic,$x,$y)
Next
EndFunc
Func _Pic()
MsgBox(0,"","jo")
EndFunc
Func _Close()
Exit
EndFunc
Die Grundidee ist, dass man den Button immer schnell anklicken muss, bevor er wechselt - dafür gibts dann vllt später mal Punkte oder so.
Das eigentliche Problem ist aber jetzt, dass der Button nicht anspricht wenn man ihn klickt - liegt wohl am sleep.
Was wäre also die Alternative?
Frage 2: Könnte ich eigentlich auch eine Grafik als Button nutzen?