Mein erstes Spiel
Anregungen und Kritik gerne erwünscht
und bitte keine scheu !
Anhang1 = Bilder
Anhang2 = Exe und Au3
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <String.au3>
#include <Misc.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 333, 160, 192, 124)
$Group1 = GUICtrlCreateGroup("Informationen", 8, 8, 297, 521)
$Label1 = GUICtrlCreateLabel("Punkte", 72, 56, 38, 17)
$Label2 = GUICtrlCreateLabel("Level", 176, 56, 30, 17)
$Label4 = GUICtrlCreateLabel("Durchgelassen", 32, 80, 75, 17)
$Group2 = GUICtrlCreateGroup("Bild", 24, 432, 121, 73)
$Label5 = GUICtrlCreateLabel("Height", 40, 456, 35, 17)
$Label6 = GUICtrlCreateLabel("Width", 40, 480, 32, 17)
$lblBh = GUICtrlCreateLabel("", 80, 456, 42, 17)
$lblBw = GUICtrlCreateLabel("", 80, 480, 42, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Maus", 152, 432, 121, 73)
$Label7 = GUICtrlCreateLabel("Height", 168, 456, 35, 17)
$Label8 = GUICtrlCreateLabel("Width", 168, 480, 32, 17)
$lblMh = GUICtrlCreateLabel("", 208, 456, 42, 17)
$lblMw = GUICtrlCreateLabel("", 208, 480, 42, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label9 = GUICtrlCreateLabel("Debug Informationen", 96, 408, 103, 17)
$Group4 = GUICtrlCreateGroup("Highscore", 24, 184, 249, 193)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$lblPunkte = GUICtrlCreateLabel("", 112, 56, 42, 17)
$lblDurchgelassen = GUICtrlCreateLabel("", 112, 80, 42, 17)
$lblLevel = GUICtrlCreateLabel("", 208, 56, 42, 17)
$Label3 = GUICtrlCreateLabel("$i ?", 24, 408, 36, 17)
$Start = GUICtrlCreateButton("Start", 32, 120, 115, 25, 0)
$Beenden = GUICtrlCreateButton("Beenden", 184, 120, 91, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 614, 442, 550, 124)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Opt("GUICloseOnESC", 1)
Opt("MouseCoordMode", 0)
FileInstall("ehec.gif", @ScriptDir & "ehec.gif")
FileInstall("ehec2.gif", @ScriptDir & "ehec2.gif")
FileInstall("ehec3.gif", @ScriptDir & "ehec3.gif")
FileInstall("ehec4.gif", @ScriptDir & "ehec4.gif")
FileInstall("ehec5.gif", @ScriptDir & "ehec5.gif")
Local $bild = "ehec.gif"
Local $bildw = 44
Local $bildh = 20
Local $x1 = 48
Local $x2 = 480
local $yy = -20
Local $xx = Random($x1,$x2)
Local $Pic1 = GUICtrlCreatePic($bild, $xx, $yy, $bildw, $bildh, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
Local $newx = $xx
Local $newy = $yy
Local $dll = DllOpen("user32.dll")
Local $points = 0
Local $level = 20
Local $LevelLBL = 1
Local $DurchgelassenLBL = 0
GUICtrlSetData($lblPunkte, $points )
GUICtrlSetData($lblLevel, $LevelLBL )
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
_close()
Case $Start
_go()
Case $Beenden
_close()
EndSwitch
WEnd
Func _go()
GUICtrlDelete($Pic1)
$Pic1 = GUICtrlCreatePic($bild, $xx, $yy, $bildw, $bildh, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
For $i = 1 to 157 Step 1
If $i = 157 Then
$DurchgelassenLBL = $DurchgelassenLBL+1
GUICtrlSetData($lblDurchgelassen, $DurchgelassenLBL )
$newx = Random($x1,$x2)
$newy = -20
_go()
EndIf
GUICtrlSetData($Label3, "$i ="&$i)
[/autoit][autoit][/autoit][autoit]$newy = $newy+3
[/autoit][autoit][/autoit][autoit]GUICtrlSetPos($Pic1, $newx, $newy)
[/autoit][autoit][/autoit][autoit]$mx = MouseGetPos(0)
$my = MouseGetPos(1)
GUICtrlSetData($lblMw, $mx)
GUICtrlSetData($lblMh, $my)
GUICtrlSetData($lblBw, $newx)
GUICtrlSetData($lblBh, $newy)
If $mx <= ($newx+44) And $mx >= $newx And $my <= ($newy+40) And $my >= ($newy+20) Then
If _IsPressed("01", $dll) Or _IsPressed("02", $dll) Then
sleep(200)
$points = $points + 10
GUICtrlSetData($lblPunkte, $points )
_killer()
$newx = Random($x1,$x2)
$newy = -20
If $points = 50 or $points = 100 or $points = 150 or $points = 200 or $points = 250 or $points = 400 or $points = 600 or $points = 800 or $points = 1200 or $points = 1600 Then
$LevelLBL = $LevelLBL+1
GUICtrlSetData($lblLevel, $LevelLBL)
$level = $level-2
If $level = 0 Then
$level = 0.1
EndIf
EndIf
_go()
EndIf
EndIf
$Timer = TimerInit()
while TimerDiff($Timer) <= $level
$dif = TimerDiff($Timer)
WEnd
If GUIGetMsg () = $Beenden Then _close()
If GUIGetMsg () = $GUI_EVENT_CLOSE Then _close()
Next
EndFunc
Func _killer()
$a = 2
For $i = 1 to 4 Step 1
GUICtrlDelete($Pic1)
$Pic1 = GUICtrlCreatePic("ehec"&$a&".gif", $newx, $newy, $bildw, $bildh, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
sleep(50)
$a = $a+1
Next
EndFunc
Func _close()
$loop = False
DLLClose($dll)
Exit
EndFunc