https://foro.gambas-es.org/viewtopic.php?f=7&t=7833&p=47210#p47210
-----------------------------------
karenc16
Lunes, 25 Noviembre 2019, 08:13

MEMORAMA
-----------------------------------
Hola, disculpen, llevo este codigo que es como el tablero de mi memorama en gambas 


¿alguien podria ayudarme a hacer que las imagenes se comparen y se salgan del tablero si son iguales? por favor
 
[code linenumbers=false syntax=gambas]
' Gambas class file

cartas[5, 6] As Object
im[16] As String
cartas2[5, 6] As Byte 
player[6] As String
win[6] As Byte
img[16] As Object 

Public Sub Form_Open()
Dim j As Byte 
Dim i As Byte 
Dim m As Byte
Dim n As Byte 
Dim x As Byte 
Dim z As Byte 
Dim l As Byte 
Dim c As Byte 

cartas[0, 0] = p1
cartas[0, 1] = p2
cartas[0, 2] = p3
cartas[0, 3] = p4
cartas[0, 4] = p5
cartas[0, 5] = p6
cartas[1, 0] = p7
cartas[1, 1] = p8
cartas[1, 2] = p9
cartas[1, 3] = p10
cartas[1, 4] = p11
cartas[1, 5] = p12
cartas[2, 0] = p13
cartas[2, 1] = p14
cartas[2, 2] = p15
cartas[2, 3] = p16
cartas[2, 4] = p17
cartas[2, 5] = p18
cartas[3, 0] = p19
cartas[3, 1] = p20
cartas[3, 2] = p21
cartas[3, 3] = p22
cartas[3, 4] = p23
cartas[3, 5] = p24
cartas[4, 0] = p25
cartas[4, 1] = p26
cartas[4, 2] = p27
cartas[4, 3] = p28
cartas[4, 4] = p29
cartas[4, 5] = p30

im[1] = "arnold.png"
im[2] = "seÃ±orbigotes.png"
im[3] = "bobesponja.png"
im[4] = "jonny.png"
im[5] = "bugs.png"
im[6] = "carlitos.png"
im[7] = "taz.png" 
im[8] = "coraje.png"
im[9] = "dexter.png"
im[10] = "eddy.png"
im[11] = "purohueso.png"
im[12] = "queso.png"
im[13] = "scooby.png"
im[14] = "shaggy.png"
im[15] = "tom.png" 

For j = 0 To 4
  For i = 0 To 5
    cartas2[j, i] = 0
  Next
Next

m = 0
n = 0
While m < 30
  x = Rnd(0, 5) 'fi
  z = Rnd(0, 6) 'co
  If cartas2[x, z] = 0 Then
    n = n + 1
    cartas2[x, z] = n
    If n = 15 Then
      n = 0
    Endif
     m = m + 1
  Endif
Wend

    For j = 0 To 4
  For i = 0 To 5
    Print cartas2[j, i],
    cartas[j, i].picture = Picture["image.jpg"] 
   
  Next
Next
End

  


Public Sub voltea(a As Byte, b As Byte)
      cartas[a, b].picture = Picture[im[cartas2[a, b]]]  
      Wait 0.5
      cartas[a, b].picture = Picture["image.jpg"] 
End


Public Sub p1_MouseDown()
      voltea(0, 0)
End
Public Sub p2_MouseDown()
      voltea(0, 1)
End

Public Sub p3_MouseDown()
      voltea(0, 2)
End
Public Sub p4_MouseDown()
      voltea(0, 3)
End

Public Sub p5_MouseDown()
      voltea(0, 4)
End
Public Sub p6_MouseDown()
      voltea(0, 5)
End
Public Sub p7_MouseDown()
      voltea(1, 0)
End
Public Sub p8_MouseDown()
      voltea(1, 1)
End
Public Sub p9_MouseDown()
      voltea(1, 2)
End
Public Sub p10_MouseDown()
      voltea(1, 3)
End
Public Sub p11_MouseDown()
      voltea(1, 4)
End
Public Sub p12_MouseDown()
      voltea(1, 5)
End
Public Sub p13_MouseDown()
      voltea(2, 0)
End
Public Sub p14_MouseDown()
      voltea(2, 1)
End
Public Sub p15_MouseDown()
      voltea(2, 2)
End
Public Sub p16_MouseDown()
      voltea(2, 3)
End
Public Sub p17_MouseDown()
      voltea(2, 4)
End
Public Sub p18_MouseDown()
      voltea(2, 5)
End
Public Sub p19_MouseDown()
      voltea(3, 0)
End
Public Sub p20_MouseDown()
      voltea(3, 1)
End
Public Sub p21_MouseDown()
      voltea(3, 2)
End
Public Sub p22_MouseDown()
      voltea(3, 3)
End
Public Sub p23_MouseDown()
      voltea(3, 4)
End
Public Sub p24_MouseDown()
      voltea(3, 5)
End
Public Sub p25_MouseDown()
      voltea(4, 0)
End
Public Sub p26_MouseDown()
      voltea(4, 1)
End
Public Sub p27_MouseDown()
      voltea(4, 2)
End
Public Sub p28_MouseDown()
      voltea(4, 3)
End
Public Sub p29_MouseDown()
      voltea(4, 4)
End
Public Sub p30_MouseDown()
      voltea(4, 5)
End
[/code]


