Hallo Leute,
ich habe folgendes Problem:
Ich möchte ein einfaches Tic-Tac-Toe Spiel erstellen mit Buttons zum benutzen der einzelnen Felder. Anschließend soll dort ein IMG angezeigt werden und der Button verschwinden dies tut er leider nicht ..
Ich hoffe mal ihr könnt mir helfen.
Ich poste mal das gesame Script und den relevanten Teil ist bei Zeile 88.
Lg NewB
Spoiler anzeigen
; Tic Tac Toe#include <ButtonConstants.au3>
[/autoit] [autoit][/autoit] [autoit]Global $Feld1 = 0
Global $Feld2 = 0
Global $Feld3 = 0
Global $Feld4 = 0
Global $Feld5 = 0
Global $Feld6 = 0
Global $Feld7 = 0
Global $Feld8 = 0
Global $Feld9 = 0
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\Welcome.kxf
$Form1 = GUICreate("Welcome!", 615, 438, 192, 124)
$Label1 = GUICtrlCreateLabel("Tic Tac Toe gegen den Computer", 104, 16, 399, 33)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Wähle eine Schwierigkeit:", 48, 72, 221, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Leicht", 160, 112, 241, 65)
$Button2 = GUICtrlCreateButton("Normal", 160, 184, 241, 73)
$Button3 = GUICtrlCreateButton("Unbesiegbar", 160, 264, 241, 73)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Koda_Einfach()
EndSwitch
WEnd
Func Koda_Einfach()
; Insert Koda Einfach hier
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=d:\daten\desktop\autoit\laptop\tic tac toe\einfach.kxf
$Form1_1 = GUICreate("Tic-Tac-Toe-Einfach", 616, 439, 192, 124)
$Label1 = GUICtrlCreateLabel("Einfach :-)", 56, 16, 89, 28)
GUICtrlSetFont($Label1, 14, 400, 0, "MS Sans Serif")
$Pic1 = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\Leer.jpg", 80, 56, 481, 353)
GUICtrlSetState($Pic1, $GUI_DISABLE)
$Button_1 = GUICtrlCreateButton("X setzen", 104, 64, 105, 89)
GUICtrlSetFont($Button_1, 14, 800, 0, "MS Sans Serif")
$Button_8 = GUICtrlCreateButton("X setzen", 254, 293, 105, 89)
GUICtrlSetFont($Button_8, 14, 800, 0, "MS Sans Serif")
$Button_2 = GUICtrlCreateButton("X setzen", 262, 61, 105, 89)
GUICtrlSetFont($Button_2, 14, 800, 0, "MS Sans Serif")
$Button_9 = GUICtrlCreateButton("X setzen", 430, 285, 105, 89)
GUICtrlSetFont($Button_9, 14, 800, 0, "MS Sans Serif")
$Button_5 = GUICtrlCreateButton("X setzen", 254, 181, 105, 89)
GUICtrlSetFont($Button_5, 14, 800, 0, "MS Sans Serif")
$Button_6 = GUICtrlCreateButton("X setzen", 430, 181, 105, 89)
GUICtrlSetFont($Button_6, 14, 800, 0, "MS Sans Serif")
$Button_4 = GUICtrlCreateButton("X setzen", 102, 181, 105, 89)
GUICtrlSetFont($Button_4, 14, 800, 0, "MS Sans Serif")
$Button_3 = GUICtrlCreateButton("X setzen", 430, 61, 105, 89)
GUICtrlSetFont($Button_3, 14, 800, 0, "MS Sans Serif")
$Button_7 = GUICtrlCreateButton("X setzen", 102, 293, 105, 89)
GUICtrlSetFont($Button_7, 14, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button_1
$x_oben_links = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\X.jpg", 104, 64, 105, 89)
MsgBox( 0 , "1" , "pic done")
GUISetState( $Button_1 , $GUI_Hide)
$Feld1 = 1
PC_Zug_Einfach()
Case $Button_2
$x_oben_mitte = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\X.jpg", 248, 64, 129, 89)
$Feld2 = 1
PC_Zug_Einfach()
Case $Button_3
$x_oben_rechts = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\X.jpg", 432, 64, 113, 97)
$Feld3 = 1
PC_Zug_Einfach()
Case $Button_4
$x_mitte_links = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\X.jpg", 104, 184, 97, 81)
$Feld4 = 1
PC_Zug_Einfach()
Case $Button_5
$x_mitte_mitte = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\X.jpg", 256, 176, 121, 89)
$Feld5 = 1
PC_Zug_Einfach()
Case $Button_6
$x_mitte_rechts = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\X.jpg", 424, 184, 113, 81)
$Feld6 = 1
PC_Zug_Einfach()
Case $Button_7
$x_unten_links = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\X.jpg", 104, 288, 105, 81)
$Feld7 = 1
PC_Zug_Einfach()
Case $Button_8
$x_unten_mitte = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\X.jpg", 256, 288, 97, 81)
$Feld8 = 1
PC_Zug_Einfach()
Case $Button_9
$x_unten_rechts = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\X.jpg", 424, 288, 105, 81)
$Feld9 = 1
PC_Zug_Einfach()
EndSwitch
WEnd
; End Koda Einfach hier
EndFunc ;==>Koda_Einfach
Func PC_Zug_Einfach()
$nummer = Random(1, 9, 1)
If $nummer = 1 And $Feld1 <> 1 Then
$o_oben_links = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\Kreis.jpg", 104, 64, 97, 89)
ElseIf $nummer = 2 And $Feld2 <> 1 Then
$o_oben_mitte = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\Kreis.jpg", 248, 64, 121, 89)
ElseIf $nummer = 3 And 1 <> $Feld3 Then
$o_oben_rechts = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\Kreis.jpg", 440, 64, 97, 89)
ElseIf $nummer = 4 And 1 <> $Feld4 Then
$o_mitte_links = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\Kreis.jpg", 112, 184, 89, 81)
ElseIf $nummer = 5 And 1 <> $Feld5 Then
$o_mitte_mitte = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\Kreis.jpg", 264, 184, 97, 81)
ElseIf $nummer = 6 And 1 <> $Feld6 Then
$o_mitte_rechts = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\Kreis.jpg", 432, 184, 97, 81)
ElseIf $nummer = 7 And 1 <> $Feld7 Then
$o_unten_links = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\Kreis.jpg", 112, 296, 89, 73)
ElseIf $nummer = 8 And $Feld8 <> 1 Then
$o_unten_mitte = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\Kreis.jpg", 264, 288, 89, 89)
ElseIf $nummer = 9 And $Feld9 <> 1 Then
$o_unten_rechts = GUICtrlCreatePic("D:\Daten\Desktop\AutoIt\Laptop\Tic Tac Toe\Kreis.jpg", 432, 288, 97, 81)
EndIf
EndFunc ;==>PC_Zug_Einfach
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit]