Gambas - Juego gambas concecta 4

 
Vista:

Juego gambas concecta 4

Publicado por aranzama (1 intervención) el 09/05/2017 14:33:35
Hola quería pedir ayuda por que he tenido problemas para realizar un juego de conecta 4 en gambas .Este es el código de mi formulario start que es donde se lleva acabo toda la operación lógica del juego , quiero saber como guardar las fichas en cada turno hacer que no se pueda volver a tirar en ese lugar, se que tengo que igualar el array del tablero a 0 y si se ocupa un lugar igualarlo a 1 y/o -1 pero no se como plantearlo en mi programa si me pudieran ayudar lo agradecería infinitamente aqui dejo mi código completo , mi tablero esta hecho con 42 picture box y es un tablero de 6x7, para tirar cada ficha es necesario hacer un drag a la columna deseada y hacer click en el jugador en el turno que corresponda
graciaaaaas, espero puedan ayudarme
attentamente
Aranza Marquez

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
' Gambas class file

tab[6, 7] As Byte
tablero[6, 7] As Object
a[5] As Byte
turno As Byte

Public Sub Form_Open()
Dim x As Byte 
Dim y As Byte 

Button2.Enabled = False
p44.Enabled = False

tablero[0, 0] = p1
tablero[1, 0] = p8
tablero[2, 0] = p9
tablero[3, 0] = p10
tablero[4, 0] = p11
tablero[5, 0] = p14

tablero[0, 1] = p2
tablero[0, 2] = p3
tablero[0, 3] = p4
tablero[0, 4] = p5
tablero[0, 5] = p6
tablero[0, 6] = p7

tablero[1, 1] = p12
tablero[2, 1] = p13
tablero[3, 1] = p15
tablero[4, 1] = p16
tablero[5, 1] = p37

tablero[1, 2] = p17
tablero[2, 2] = p22
tablero[3, 2] = p27
tablero[4, 2] = p32
tablero[5, 2] = p38

tablero[1, 3] = p18
tablero[2, 3] = p23
tablero[3, 3] = p28
tablero[4, 3] = p33
tablero[5, 3] = p39

tablero[1, 4] = p19
tablero[2, 4] = p24
tablero[3, 4] = p29
tablero[4, 4] = p34
tablero[5, 4] = p40

tablero[1, 5] = p20
tablero[2, 5] = p25
tablero[3, 5] = p30
tablero[4, 5] = p35
tablero[5, 5] = p41

tablero[1, 6] = p21
tablero[2, 6] = p26
tablero[3, 6] = p31
tablero[4, 6] = p36
tablero[5, 6] = p42

p45.drop = True
p43.tag = "ficha1.png"
p43.picture = Picture["ficha1.png"]

p44.tag = "ficha2.png"
p44.picture = Picture["ficha2.png"]

For x = 0 To 5 
For y = 0 To 6 
tab[x, y] = 0
Next
Next
End

Public Sub p43_MouseDrag()
Drag.icon = Last.picture
p43.Drag(p43.tag)
End

Public Sub p44_MouseDrag()
Drag.icon = Last.picture
p44.Drag(p44.tag)
End

Public Sub p45_Drop()
Dim x As Byte
Dim y As Byte

p45.Picture = Picture[Drag.Data]

For x = 0 To 5
tablero[x, 0].Picture = Picture[Drag.Data]

If x <> 0 Then 
tablero[x - 1, 0].picture = Picture["tablero.png"]
End If

Wait 0.5
Next

End

Public Sub p46_Drop()
Dim x As Byte

p46.Picture = Picture[Drag.Data]

For x = 0 To 5
tablero[x, 1].Picture = Picture[Drag.Data]
If x <> 0 Then 
tablero[x - 1, 1].picture = Picture["tablero.png"]
End If 
Wait 0.5 
Next


End

Public Sub p47_Drop()
Dim x As Byte

p47.Picture = Picture[Drag.Data]

For x = 0 To 5
tablero[x, 2].Picture = Picture[Drag.Data]
If x <> 0 Then 
tablero[x - 1, 2].picture = Picture["tablero.png"]
End If 
Wait 0.5 
Next

End

Public Sub p48_Drop()
Dim x As Byte

p48.Picture = Picture[Drag.Data]

For x = 0 To 5
tablero[x, 3].Picture = Picture[Drag.Data]
If x <> 0 Then 
tablero[x - 1, 3].picture = Picture["tablero.png"]
End If 
Wait 0.5 
Next

End

Public Sub p49_Drop()
Dim x As Byte

p49.Picture = Picture[Drag.Data]

For x = 0 To 5
tablero[x, 4].Picture = Picture[Drag.Data]
If x <> 0 Then 
tablero[x - 1, 4].picture = Picture["tablero.png"]
End If 
Wait 0.5
Next

End

Public Sub p50_Drop()
Dim x As Byte
Dim y As Byte
Dim t As Float

p50.Picture = Picture[Drag.Data]

For x = 0 To 5
tablero[x, 5].Picture = Picture[Drag.Data]
If x <> 0 Then 
tablero[x - 1, 5].picture = Picture["tablero.png"]
End If 
Wait 0.5 
Next

End

Public Sub p51_Drop()
Dim x As Byte

p51.Picture = Picture[Drag.Data]
For x = 0 To 5
tablero[x, 6].Picture = Picture[Drag.Data]
If x <> 0 Then 
tablero[x - 1, 1].picture = Picture["tablero.png"]
End If 
Wait 0.5
Next
End

Public Sub Button3_Click()
Form2.Close()
Message.Info("Gracias por Jugar")
End

Public Sub Button1_Click()
Button1.Enabled = False
Button2.Enabled = True
p43.Enabled = True
p44.Enabled = False
End

Public Sub Button2_Click()
Button1.Enabled = True
Button2.Enabled = False
p43.Enabled = False
p44.Enabled = True

End

Public Sub Button4_Click()

Form2.Hide()
FMain.Show()

End
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder