Hallo Leute,
ich habe ein Problem. Und zwar möchte ich ein Spiel programmieren,
indem sich mehrere Objekte unabhängig voneinander bewegen. Sie sollen
in unterschiedlichen Geschwindigkeiten bewegt werden.
Wie kann ich das am besten anstellen?
Habe da schonmal was vorbereitet, allerdings noch ohne GDI+, weil das bei
mir irgendwie nicht hingehauen hat.
Bisheriges Skript
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <misc.au3>
$Height = 50
$Width = 50
$IchPosition = 2
$Form1 = GUICreate("Form1", 410, 126, 192, 124)
$Ich = GUICtrlCreateLabel("", 24, 60, $Width, $Height)
GUICtrlSetBkColor(-1, 0x000000)
$Gegner = GUICtrlCreateLabel("", 192, 8, $Width, $Height)
GUICtrlSetBkColor(-1, 0x800000)
GUISetState(@SW_SHOW)
AdlibRegister("_ChangePosition", 40)
_GegnerLinks(2)
[/autoit] [autoit][/autoit] [autoit]While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _GegnerLinks($Position)
;~ Func _GegnerLinks()
;~ $Position = 1
Switch $Position
Case 1
$Position = 10
Case 2
$Position = 60
EndSwitch
For $i = 410 To -$Width Step -10
GUICtrlSetPos($Gegner, $i, $Position)
$IchPos = ControlGetPos("","", $Ich)
$Sleep = TimerInit()
While TimerDiff($Sleep) < 100
WEnd
Next
EndFunc
Func _ChangePosition()
If _IsPressed(01) Then
If $IchPosition = 1 Then
$IchPosition = 2
GUICtrlSetPos($Ich, 24, 60)
Else
$IchPosition = 1
GUICtrlSetPos($Ich, 24, 10)
EndIf
While _IsPressed(01)
WEnd
EndIf
EndFunc
Ziel ist es, dass man den Blöcken ausweicht.
Danke für Antworten im voraus!
MfG
qixx