Hey,
Ich bin relativ neu bei Autoit die grundlagen und ein bisschen kann ich schon doch ich habe ein problem bei ein schreiben von ein Spiel. Ich versuche das so hinzubekommen das 2 Spieler spielen, der erste würfelt und der punkt geht dann so weit, der 2 würfelt und geht dann soweit... usw. doch es scheitert schon bei der umsetztung . Bisher habe ich nur den 1. Würfelzug so das die spieler bis max. 6 felder vorrücken doch wenn ich dann ein 2. mal würfel und die zahl kleiner ist gehen die figuren wieder zurück . Bitte um hilfe (Am ende des schwarzen balkens soll das ziel sein!)
Spoiler anzeigen
Global $Ysp1 = 72
Global $Ysp2 = 104
Global $X1 = 16
Global $X2 = 24
Global $X3 = 32
Global $X4 = 40
Global $X5 = 48
Global $X6 = 56
Global $X7 = 64
Global $X8 = 72
Global $X9 = 80
Global $X10 = 88
Global $X11 = 96
Global $X12 = 104
Global $X13 = 112
Global $X14 = 120
Global $X15 = 128
Global $X16 = 136
Global $X17 = 144
Global $X18 = 152
Global $X19 = 160
Global $X20 = 168
Global $X21 = 176
Global $X22 = 184
Global $X23 = 192
Global $X24 = 200
Global $X25 = 208
Global $X26 = 216
Global $X27 = 224
Global $X28 = 232
Global $X29 = 240
Global $X30 = 248
Global $X31 = 256
Global $X32 = 264
Global $X33 = 272
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region
$Form1 = GUICreate("Spiel", 315, 169, 354, 345)
GUISetBkColor(0x00FF00)
$Spieler1 = GUICtrlCreateLabel("", 8, 72, 20, 20)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0xFF0000)
$Label1 = GUICtrlCreateLabel("Label1", 8, 48, 284, 9)
GUICtrlSetBkColor(-1, 0x000000)
$Spieler2 = GUICtrlCreateLabel("", 8, 104, 20, 20)
GUICtrlSetBkColor(-1, 0x0000FF)
$MyButton1 = GUICtrlCreateButton("Würfel für Sp. 1", 24, 8, 100, 30, $BS_FLAT)
$MyButton2 = GUICtrlCreateButton("Würfel für Sp. 2", 152, 8, 100, 30, $BS_FLAT)
GUISetState(@SW_SHOW)
#EndRegion
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $MyButton1
Switch Random (1,6,1)
Case 1
GUICtrlSetPos($Spieler1,$X1,$Ysp1)
ToolTip ("Du hast 1 gewürfelt!",369,522)
Sleep (500)
Case 2
GUICtrlSetPos($Spieler1,$X2,$Ysp1)
ToolTip ("Du hast 2 gewürfelt!",369,522)
Sleep (500)
Case 3
GUICtrlSetPos($Spieler1,$X3,$Ysp1)
ToolTip ("Du hast 3 gewürfelt!",369,522)
Sleep (500)
Case 4
GUICtrlSetPos($Spieler1,$X4,$Ysp1)
ToolTip ("Du hast 4 gewürfelt!",369,522)
Sleep (500)
Case 5
GUICtrlSetPos($Spieler1,$X5,$Ysp1)
ToolTip ("Du hast 5 gewürfelt!",369,522)
Sleep (500)
Case 6
GUICtrlSetPos($Spieler1,$X6,$Ysp1)
ToolTip ("Du hast 6 gewürfelt!",369,522)
Sleep (500)
EndSwitch
MsgBox (0,"Spieler Wechsel","Spieler 2 du bist dran!")
Case $MyButton2
Switch Random (1,6,1)
Case 1
GUICtrlSetPos($Spieler2,$X1,$Ysp2)
ToolTip ("Du hast 1 gewürfelt!",369,522)
Sleep (500)
Case 2
GUICtrlSetPos($Spieler2,$X2,$Ysp2)
ToolTip ("Du hast 2 gewürfelt!",369,522)
Sleep (500)
Case 3
GUICtrlSetPos($Spieler2,$X3,$Ysp2)
ToolTip ("Du hast 3 gewürfelt!",369,522)
Sleep (500)
Case 4
GUICtrlSetPos($Spieler2,$X4,$Ysp2)
ToolTip ("Du hast 4 gewürfelt!",369,522)
Sleep (500)
Case 5
GUICtrlSetPos($Spieler2,$X5,$Ysp2)
ToolTip ("Du hast 5 gewürfelt!",369,522)
Sleep (500)
Case 6
GUICtrlSetPos($Spieler2,$X6,$Ysp2)
ToolTip ("Du hast 6 gewürfelt!",369,522)
Sleep (500)
EndSwitch
MsgBox (0,"Spieler Wechsel","Spieler 1 du bist dran!")
EndSwitch
WEnd
Hoffe um hilfe
PS: wenns geht mit erklärung wie ihr auf die lösung gekommen seid