Ik heb een opdracht waarbij is een memoryspel moet maken met de volgende code:
Nu wil ik als er 2 plaatjes hetzelfde zijn dat deze blijven staan. Hoe doe ik dit, nu krijg ik dit:

Ook wil ik dat hij de plaatjes bij het laden random neerzet !
Wie helpt ?
code:
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
| Private Sub Form_Load()
Dim C(8)
Dim B(15)
Dim P1
Dim P2
Dim C1
Dim C12
Dim klik
Dim r
Randomize
Me.Left = Screen.Width / 2 - Me.Width / 2
Me.Top = Screen.Height / 2 - Me.Height / 2
Randomize Timer
For i = 0 To 15
picture1(i).Picture = plaatjes.Picture2.Picture
Next i
For i = 0 To 15
Do
r = Int(Rnd * 9)
Loop Until C(r) < 2
C(r) = C(r) + 1
B(i) = r
Next i
Cl = 0
End Sub
Private Sub Picture1_Click(Index As Integer)
Dim C(8)
Dim B(15)
Dim P1
Dim P2
Dim Cl
Dim Cl2
Dim klik
Dim r
Cl = Cl + 1
If Cl = 1 Then Cl2 = Index
If Cl = 2 And Cl2 = Index Then
Cl = 1
Exit Sub
End If
picture1(Index).Picture = plaatjes.picture1(B(Index)).Picture
If Cl = 2 Then
For i = 0 To 2000000: Next i
If B(Cl2) = B(Index) Then
picture1(Cl2).Visible = True
picture1(Cl2).Enabled = True
picture1(Index).Visible = True
picture1(Index).Enabled = True
Else
picture1(Cl2).Picture = plaatjes.Picture2.Picture
picture1(Index).Picture = plaatjes.Picture2.Picture
End If
Cl = 0: Cl2 = 0
End If
For i = 1 To 20
For i2 = 1 To 350000: Next i2
Next i
End Sub |
Nu wil ik als er 2 plaatjes hetzelfde zijn dat deze blijven staan. Hoe doe ik dit, nu krijg ik dit:
Ook wil ik dat hij de plaatjes bij het laden random neerzet !
Wie helpt ?