Hallo,
ich will ein Spiel aus langeweile schreiben und stoße schon an ein Problem.
Wenn ich mit meinem Raumschiff schiesen will, dann fliegt die kugel nach oben, und wenn ich dann nochmal schiesen will dann bleibt die stehen und die neu fliegt weiter oder die erste Kugel fliegt zu Ende und die neue Kugel wartet auf die davor und fliegt erst weiter wenn die erste weg ist.
Wie krige ich nun hin das die sofort hintereinander fliegen ?
Spoiler anzeigen
#include <Array.au3>
#include <Misc.au3>
#include <GUIConstantsEx.au3>
Global $timer = 0
Global $schusse[1], $schuss[2]
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Spiel", 633, 447)
GUISetBkColor(0x000000)
$raumschiff = GUICtrlCreatePic(@ScriptDir & "\img\raumschiff.jpg", 10, 410, 50, 30)
$schuss[1] = GUICtrlCreatePic(@ScriptDir & "\img\schuss.JPG", 33, 393, 5, 15)
GUICtrlSetState (-1,$GUI_HIDE)
$gegner = GUICtrlCreatePic("", 40, 64, 52, 28)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
If _IsPressed(20) Then
While _IsPressed(20)
Sleep(100)
WEnd
For $i = 1 To UBound($schuss) - 1
If GUICtrlGetState($schuss[$i]) <> 80 Then
GUICtrlSetState($schuss[$i], $GUI_SHOW)
$timer = TimerInit()
Else
$schuss[$i] = GUICtrlCreatePic(@ScriptDir & "\img\schuss.JPG", 33, 393, 5, 15)
_ArrayAdd($schuss, "")
_ArrayAdd($schusse, "")
EndIf
Next
EndIf
For $i = 1 To UBound($schusse) - 1
If GUICtrlGetState($schuss[$i]) = 80 Then
If TimerDiff($timer) >= 100 Then
$schuss_pos = ControlGetPos($Form1, "", $schuss[$i])
GUICtrlSetPos($schuss[$i], $schuss_pos[0], $schuss_pos[1] - 17)
If $schuss_pos[1] <= 0 Then
GUICtrlSetPos($schuss[$i], $schuss_pos[0], 393)
GUICtrlSetState($schuss[$i], $GUI_HIDE)
GUICtrlDelete($schuss[$i])
_ArrayDelete($schuss, "")
_ArrayDelete($schusse, "")
EndIf
$timer = TimerInit()
EndIf
EndIf
Next
ToolTip(UBound($schuss) & @CRLF & UBound($schusse), 0, 0)
WEnd