bendown
asked on
TWO QUESTIONS = 100 Points
First: I would like to be able to put a "blank" picture over each of the Match Game pictures below. (like the back of a deck of cards). When someone clicks the card, the picture behind the card would be visible until they clicked another card to try and match the picture.
Second: I would like a way to make the pictures position move at random each time a new game is started. In brevity:
"A simple match game where you click on a picture and try and match it to another picture and each new game would put the pictures into another position at random". Here is the code that I have now...
Thanks
Option Explicit
' A CHILD'S GAME THAT HAS SIX IMAGES AND A RESET BUTTON.
' CLICKING TWO IDENTICAL IMAGES MAKES THEM DISAPPEAR.
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Dim PicClicked(12) As Boolean ' A Yes/No array, indexed 0 to 11
Dim ClickNum As Integer ' Keeps track of clicks
Private Sub Command1_Click() 'reset button
Dim i As Integer
Dim rvalue As Double
For i = 0 To 11
PicClicked(i) = False
Image1(i).Visible = True
Image1(i).BorderStyle = 0
Next i
ClickNum = 0
Me.Refresh
rvalue = PlaySound("c:\windows\medi a\office97 \chimes.wa v", 0, 0)
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim rvalue As Double
For i = 0 To 11
PicClicked(i) = False
Next i
rvalue = PlaySound("c:\windows\medi a\office97 \chimes.wa v", 0, 0)
End Sub
Private Sub Image1_Click(Index As Integer)
Dim i As Integer
Dim rvalue As Double
' When an image is clicked, this subroutine is called
ClickNum = ClickNum + 1 ' increment the click counter
If ClickNum = 1 Then ' No clicks before the present one
PicClicked(Index) = True ' Image(Index) has been clicked
Image1(Index).BorderStyle = 1
ClickNum = 1 ' increment click counter
ElseIf ClickNum = 2 Then ' The present click is the second one
PicClicked(Index) = True ' A second image has been clicked
Image1(Index).BorderStyle = 1
Me.Refresh
ClickNum = 0 ' reset click counter
' image(0) is the same as image (2), etc.
' see if they have both been clicked
If PicClicked(0) = True And PicClicked(2) = True Then
Success 0, 2
Exit Sub
ElseIf PicClicked(1) = True And PicClicked(9) = True Then
Success 1, 9
Exit Sub
ElseIf PicClicked(3) = True And PicClicked(4) = True Then
Success 3, 4
Exit Sub
ElseIf PicClicked(5) = True And PicClicked(8) = True Then
Success 5, 8
Exit Sub
ElseIf PicClicked(6) = True And PicClicked(7) = True Then
Success 6, 7
Exit Sub
ElseIf PicClicked(10) = True And PicClicked(11) = True Then
Success 10, 11
Exit Sub
Else
rvalue = PlaySound("c:\Match\tryaga in.wav", 0, 0)
For i = 0 To 11
Image1(i).BorderStyle = 1
Next i
Me.Refresh
rvalue = PlaySound("c:\Match\laser. wav", 0, 0)
For i = 0 To 11
Image1(i).BorderStyle = 0
Next i
Me.Refresh
rvalue = PlaySound("c:\Match\laser. wav", 0, 0)
For i = 0 To 11
Image1(i).BorderStyle = 1
Next i
Me.Refresh
rvalue = PlaySound("c:\Match\laser. wav", 0, 0)
For i = 0 To 11
Image1(i).BorderStyle = 0
Next i
Me.Refresh
End If
For i = 0 To 11
PicClicked(i) = False ' reset the game after two clicks
Image1(i).BorderStyle = 0
Next i
End If
End Sub
Private Sub Success(img1 As Integer, img2 As Integer)
Dim i As Integer
Dim rvalue As Long
' Values for img1 and img2 are passed to the subroutine
' when it is called, e.g. Success 0, 2 calls this sub, and
' sets img1 to 0 and img2 to 2.
' The two images are then "turned off"
Image1(img1).Visible = False
Image1(img2).Visible = False
Me.Refresh
For i = 0 To 11
PicClicked(i) = False ' reset values
Next i
' Play the goodjob sound
rvalue = PlaySound("c:\Match\goodjo b.wav", 0, 0)
' If any images left, go back and continue play
For i = 0 To 11
If Image1(i).Visible = True Then Exit Sub
Next i
' Otherwise, play the applause sound and reset the game
rvalue = PlaySound("c:\Match\yes.wa v", 0, 0)
For i = 0 To 11
PicClicked(i) = False
Image1(i).Visible = True
Image1(i).BorderStyle = 0
Next i
ClickNum = 0
Me.Refresh
End Sub
Second: I would like a way to make the pictures position move at random each time a new game is started. In brevity:
"A simple match game where you click on a picture and try and match it to another picture and each new game would put the pictures into another position at random". Here is the code that I have now...
Thanks
Option Explicit
' A CHILD'S GAME THAT HAS SIX IMAGES AND A RESET BUTTON.
' CLICKING TWO IDENTICAL IMAGES MAKES THEM DISAPPEAR.
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Dim PicClicked(12) As Boolean ' A Yes/No array, indexed 0 to 11
Dim ClickNum As Integer ' Keeps track of clicks
Private Sub Command1_Click() 'reset button
Dim i As Integer
Dim rvalue As Double
For i = 0 To 11
PicClicked(i) = False
Image1(i).Visible = True
Image1(i).BorderStyle = 0
Next i
ClickNum = 0
Me.Refresh
rvalue = PlaySound("c:\windows\medi
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim rvalue As Double
For i = 0 To 11
PicClicked(i) = False
Next i
rvalue = PlaySound("c:\windows\medi
End Sub
Private Sub Image1_Click(Index As Integer)
Dim i As Integer
Dim rvalue As Double
' When an image is clicked, this subroutine is called
ClickNum = ClickNum + 1 ' increment the click counter
If ClickNum = 1 Then ' No clicks before the present one
PicClicked(Index) = True ' Image(Index) has been clicked
Image1(Index).BorderStyle = 1
ClickNum = 1 ' increment click counter
ElseIf ClickNum = 2 Then ' The present click is the second one
PicClicked(Index) = True ' A second image has been clicked
Image1(Index).BorderStyle = 1
Me.Refresh
ClickNum = 0 ' reset click counter
' image(0) is the same as image (2), etc.
' see if they have both been clicked
If PicClicked(0) = True And PicClicked(2) = True Then
Success 0, 2
Exit Sub
ElseIf PicClicked(1) = True And PicClicked(9) = True Then
Success 1, 9
Exit Sub
ElseIf PicClicked(3) = True And PicClicked(4) = True Then
Success 3, 4
Exit Sub
ElseIf PicClicked(5) = True And PicClicked(8) = True Then
Success 5, 8
Exit Sub
ElseIf PicClicked(6) = True And PicClicked(7) = True Then
Success 6, 7
Exit Sub
ElseIf PicClicked(10) = True And PicClicked(11) = True Then
Success 10, 11
Exit Sub
Else
rvalue = PlaySound("c:\Match\tryaga
For i = 0 To 11
Image1(i).BorderStyle = 1
Next i
Me.Refresh
rvalue = PlaySound("c:\Match\laser.
For i = 0 To 11
Image1(i).BorderStyle = 0
Next i
Me.Refresh
rvalue = PlaySound("c:\Match\laser.
For i = 0 To 11
Image1(i).BorderStyle = 1
Next i
Me.Refresh
rvalue = PlaySound("c:\Match\laser.
For i = 0 To 11
Image1(i).BorderStyle = 0
Next i
Me.Refresh
End If
For i = 0 To 11
PicClicked(i) = False ' reset the game after two clicks
Image1(i).BorderStyle = 0
Next i
End If
End Sub
Private Sub Success(img1 As Integer, img2 As Integer)
Dim i As Integer
Dim rvalue As Long
' Values for img1 and img2 are passed to the subroutine
' when it is called, e.g. Success 0, 2 calls this sub, and
' sets img1 to 0 and img2 to 2.
' The two images are then "turned off"
Image1(img1).Visible = False
Image1(img2).Visible = False
Me.Refresh
For i = 0 To 11
PicClicked(i) = False ' reset values
Next i
' Play the goodjob sound
rvalue = PlaySound("c:\Match\goodjo
' If any images left, go back and continue play
For i = 0 To 11
If Image1(i).Visible = True Then Exit Sub
Next i
' Otherwise, play the applause sound and reset the game
rvalue = PlaySound("c:\Match\yes.wa
For i = 0 To 11
PicClicked(i) = False
Image1(i).Visible = True
Image1(i).BorderStyle = 0
Next i
ClickNum = 0
Me.Refresh
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Cut the old code from your form, and save it. Paste this replacement code into your form. As before, some of the .WAV files might need to be changed, or the ImgPath value that is set when the form loads.
Option Explicit
' A CHILD'S GAME THAT HAS SIX IMAGES AND A BUTTON ON A FORM.
' PUT ONE IMAGE ON A FORM, COPY IT AND THEN PASTE IT REPEATEDLY
' TO CREATE A CONTROL ARRAY.
' CHANGE THE PICTURE PROPERTY, SIZE, ETC. OF EACH ONE SEPARATELY.
' CLICKING TWO IDENTICAL IMAGES MAKES THEM DISAPPEAR
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Dim ClickNum As Integer ' Keeps track of clicks
Dim Pic(6) As String ' Picture names
Dim Clicked(2) As Integer ' Which 2 images are clicked
Dim ImgPath As String ' Where the pictures are
Sub Shuffle()
Dim i, j As Integer
Dim ImgName As String
Dim upperbound As Single
Dim lowerbound As Single
Dim rvalue As Double
upperbound = 5 ' upperbound + 1 = number of images on form
lowerbound = 0
For i = 0 To 5 ' No picture names yet
Pic(i) = ""
Next i
For i = 1 To 3
' Get the first image's name
ImgName = "Img" & i & ".bmp"
' Put the image in one spot
Do
' Generate a random number between 0 and 5
j = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
If Pic(j) = "" Then
Pic(j) = ImgPath & ImgName
Exit Do
End If
Loop
' Put the same image in another spot
Do
j = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
If Pic(j) = "" Then
Pic(j) = ImgPath & ImgName
Exit Do
End If
Loop
Next i
For i = 0 To 5
Image1(i).Picture = LoadPicture(ImgPath & "CardBack.bmp")
Image1(i).BorderStyle = 0
Image1(i).Visible = True
Next i
ClickNum = 0
Me.Refresh
rvalue = PlaySound("c:\windows\medi a\office97 \chimes.wa v", 0, 0)
End Sub
Private Sub Command1_Click() 'reset button
Shuffle ' Call the shuffle routine
End Sub
Private Sub Form_Load()
ImgPath = "C:\Program Files\DevStudio\Memory Game\"
Shuffle
End Sub
Private Sub Image1_Click(Index As Integer)
Dim i As Integer
Dim rvalue As Double
' When an image is clicked, this subroutine is called
ClickNum = ClickNum + 1 ' increment the click counter
If ClickNum = 1 Then ' No clicks before the present one
Clicked(1) = Index
Image1(Index).Picture = LoadPicture(Pic(Index))
Image1(Index).BorderStyle = 1
ElseIf ClickNum = 2 Then
If Index = Clicked(1) Then ' Same image clicked twice
ClickNum = 1
Exit Sub
End If
Clicked(2) = Index
Image1(Index).Picture = LoadPicture(Pic(Index))
Image1(Index).BorderStyle = 1
Me.Refresh
If Pic(Clicked(1)) = Pic(Clicked(2)) Then
rvalue = PlaySound("c:\windows\medi a\tada.wav ", 0, 0)
Success Clicked(1), Clicked(2)
Else
rvalue = PlaySound("c:\windows\medi a\office97 \laser.wav ", 0, 0)
For i = 0 To 5
Image1(i).Picture = LoadPicture(ImgPath & "CardBack.bmp")
Image1(i).BorderStyle = 1
Next i
Me.Refresh
rvalue = PlaySound("c:\windows\medi a\office97 \laser.wav ", 0, 0)
For i = 0 To 5
Image1(i).BorderStyle = 0
Next i
Me.Refresh
rvalue = PlaySound("c:\windows\medi a\office97 \laser.wav ", 0, 0)
For i = 0 To 5
Image1(i).BorderStyle = 1
Next i
Me.Refresh
rvalue = PlaySound("c:\windows\medi a\office97 \laser.wav ", 0, 0)
For i = 0 To 5
Image1(i).BorderStyle = 0
Next i
Me.Refresh
End If
ClickNum = 0 ' reset click counter
End If
End Sub
Private Sub Success(img1 As Integer, img2 As Integer)
Dim i As Integer
Dim rvalue As Long
' Values for img1 and img2 are passed to the subroutine
' The two images are then "turned off"
Image1(img1).Visible = False
Image1(img2).Visible = False
Me.Refresh
' Play the whoosh sound
rvalue = PlaySound("c:\windows\medi a\office97 \whoosh.wa v", 0, 0)
' If any images left, go back and continue play
For i = 0 To 5
If Image1(i).Visible = True Then Exit Sub
Next i
' Otherwise, play the applause sound and reset the game
rvalue = PlaySound("c:\windows\medi a\office97 \applause. wav", 0, 0)
Shuffle
End Sub
Option Explicit
' A CHILD'S GAME THAT HAS SIX IMAGES AND A BUTTON ON A FORM.
' PUT ONE IMAGE ON A FORM, COPY IT AND THEN PASTE IT REPEATEDLY
' TO CREATE A CONTROL ARRAY.
' CHANGE THE PICTURE PROPERTY, SIZE, ETC. OF EACH ONE SEPARATELY.
' CLICKING TWO IDENTICAL IMAGES MAKES THEM DISAPPEAR
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Dim ClickNum As Integer ' Keeps track of clicks
Dim Pic(6) As String ' Picture names
Dim Clicked(2) As Integer ' Which 2 images are clicked
Dim ImgPath As String ' Where the pictures are
Sub Shuffle()
Dim i, j As Integer
Dim ImgName As String
Dim upperbound As Single
Dim lowerbound As Single
Dim rvalue As Double
upperbound = 5 ' upperbound + 1 = number of images on form
lowerbound = 0
For i = 0 To 5 ' No picture names yet
Pic(i) = ""
Next i
For i = 1 To 3
' Get the first image's name
ImgName = "Img" & i & ".bmp"
' Put the image in one spot
Do
' Generate a random number between 0 and 5
j = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
If Pic(j) = "" Then
Pic(j) = ImgPath & ImgName
Exit Do
End If
Loop
' Put the same image in another spot
Do
j = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
If Pic(j) = "" Then
Pic(j) = ImgPath & ImgName
Exit Do
End If
Loop
Next i
For i = 0 To 5
Image1(i).Picture = LoadPicture(ImgPath & "CardBack.bmp")
Image1(i).BorderStyle = 0
Image1(i).Visible = True
Next i
ClickNum = 0
Me.Refresh
rvalue = PlaySound("c:\windows\medi
End Sub
Private Sub Command1_Click() 'reset button
Shuffle ' Call the shuffle routine
End Sub
Private Sub Form_Load()
ImgPath = "C:\Program Files\DevStudio\Memory Game\"
Shuffle
End Sub
Private Sub Image1_Click(Index As Integer)
Dim i As Integer
Dim rvalue As Double
' When an image is clicked, this subroutine is called
ClickNum = ClickNum + 1 ' increment the click counter
If ClickNum = 1 Then ' No clicks before the present one
Clicked(1) = Index
Image1(Index).Picture = LoadPicture(Pic(Index))
Image1(Index).BorderStyle = 1
ElseIf ClickNum = 2 Then
If Index = Clicked(1) Then ' Same image clicked twice
ClickNum = 1
Exit Sub
End If
Clicked(2) = Index
Image1(Index).Picture = LoadPicture(Pic(Index))
Image1(Index).BorderStyle = 1
Me.Refresh
If Pic(Clicked(1)) = Pic(Clicked(2)) Then
rvalue = PlaySound("c:\windows\medi
Success Clicked(1), Clicked(2)
Else
rvalue = PlaySound("c:\windows\medi
For i = 0 To 5
Image1(i).Picture = LoadPicture(ImgPath & "CardBack.bmp")
Image1(i).BorderStyle = 1
Next i
Me.Refresh
rvalue = PlaySound("c:\windows\medi
For i = 0 To 5
Image1(i).BorderStyle = 0
Next i
Me.Refresh
rvalue = PlaySound("c:\windows\medi
For i = 0 To 5
Image1(i).BorderStyle = 1
Next i
Me.Refresh
rvalue = PlaySound("c:\windows\medi
For i = 0 To 5
Image1(i).BorderStyle = 0
Next i
Me.Refresh
End If
ClickNum = 0 ' reset click counter
End If
End Sub
Private Sub Success(img1 As Integer, img2 As Integer)
Dim i As Integer
Dim rvalue As Long
' Values for img1 and img2 are passed to the subroutine
' The two images are then "turned off"
Image1(img1).Visible = False
Image1(img2).Visible = False
Me.Refresh
' Play the whoosh sound
rvalue = PlaySound("c:\windows\medi
' If any images left, go back and continue play
For i = 0 To 5
If Image1(i).Visible = True Then Exit Sub
Next i
' Otherwise, play the applause sound and reset the game
rvalue = PlaySound("c:\windows\medi
Shuffle
End Sub
In the ImgPath directory, put the following graphic files: Img1.bmp, Img2.bmp, Img3.bmp, and CardBack.bmp.
ASKER
Thank You. When I get some more points, I will Point Another Question to you. It will concern the same code as per above.
Thanks
Thanks
THIS CODE WILL SUPPORT 20 IMAGES ON A FORM, AND TEN DIFFERENT PICTURES (Img1.bmp - Img10.bmp). PASTE IT INTO A FORM TO REPLACE THE EARLIER CODES.
Option Explicit
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Dim ClickNum As Integer ' Keeps track of clicks
Dim Pic(20) As String ' Picture names
Dim Clicked(2) As Integer ' Which 2 images are clicked
Dim ImgPath As String ' Where the pictures are
Sub Shuffle()
Dim i, j As Integer
Dim ImgName As String
Dim upperbound As Single
Dim lowerbound As Single
Dim rvalue As Double
upperbound = 19 ' upperbound + 1 = number of images on form
lowerbound = 0
For i = 0 To 19 ' No picture names yet
Pic(i) = ""
Next i
For i = 1 To 10
' Get the first image's name
ImgName = "Img" & i & ".bmp"
' Put the image in one spot
Do
' Generate a random number between 0 and 19
j = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
If Pic(j) = "" Then
Pic(j) = ImgPath & ImgName
Exit Do
End If
Loop
' Put the same image in another spot
Do
j = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
If Pic(j) = "" Then
Pic(j) = ImgPath & ImgName
Exit Do
End If
Loop
Next i
For i = 0 To 19
Image1(i).Picture = LoadPicture(ImgPath & "CardBack.bmp")
Image1(i).BorderStyle = 0
Image1(i).Visible = True
Next i
ClickNum = 0
Me.Refresh
rvalue = PlaySound("c:\windows\medi a\office97 \laser.wav ", 0, 0)
End Sub
Private Sub Form_Load()
ImgPath = "C:\Program Files\DevStudio\Memory Game\"
Shuffle
End Sub
Private Sub Image1_Click(Index As Integer)
Dim i As Integer
Dim rvalue As Double
' When an image is clicked, this subroutine is called
ClickNum = ClickNum + 1 ' increment the click counter
If ClickNum = 1 Then ' No clicks before the present one
Clicked(1) = Index
Image1(Index).Picture = LoadPicture(Pic(Index))
Image1(Index).BorderStyle = 1
ElseIf ClickNum = 2 Then
If Index = Clicked(1) Then ' Same image clicked twice
ClickNum = 1
Exit Sub
End If
Clicked(2) = Index
Image1(Index).Picture = LoadPicture(Pic(Index))
Image1(Index).BorderStyle = 1
Me.Refresh
If Pic(Clicked(1)) = Pic(Clicked(2)) Then
rvalue = PlaySound("c:\windows\medi a\tada.wav ", 0, 0)
Success Clicked(1), Clicked(2)
Else
rvalue = PlaySound("c:\windows\medi a\office97 \laser.wav ", 0, 0)
For i = 0 To 19
Image1(i).Picture = LoadPicture(ImgPath & "CardBack.bmp")
Image1(i).BorderStyle = 0
Next i
Me.Refresh
End If
ClickNum = 0 ' reset click counter
End If
End Sub
Private Sub Success(img1 As Integer, img2 As Integer)
Dim i As Integer
Dim rvalue As Long
' Values for img1 and img2 are passed to the subroutine
' The two images are then "turned off"
Image1(img1).Visible = False
Image1(img2).Visible = False
Me.Refresh
' Play the whoosh sound
rvalue = PlaySound("c:\windows\medi a\office97 \whoosh.wa v", 0, 0)
' If any images left, go back and continue play
For i = 0 To 19
If Image1(i).Visible = True Then Exit Sub
Next i
' Otherwise, play the applause sound and reset the game
rvalue = PlaySound("c:\windows\medi a\office97 \applause. wav", 0, 0)
Shuffle
End Sub
Private Sub Command1_Click() ' Reset button
Shuffle
End Sub
Option Explicit
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Dim ClickNum As Integer ' Keeps track of clicks
Dim Pic(20) As String ' Picture names
Dim Clicked(2) As Integer ' Which 2 images are clicked
Dim ImgPath As String ' Where the pictures are
Sub Shuffle()
Dim i, j As Integer
Dim ImgName As String
Dim upperbound As Single
Dim lowerbound As Single
Dim rvalue As Double
upperbound = 19 ' upperbound + 1 = number of images on form
lowerbound = 0
For i = 0 To 19 ' No picture names yet
Pic(i) = ""
Next i
For i = 1 To 10
' Get the first image's name
ImgName = "Img" & i & ".bmp"
' Put the image in one spot
Do
' Generate a random number between 0 and 19
j = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
If Pic(j) = "" Then
Pic(j) = ImgPath & ImgName
Exit Do
End If
Loop
' Put the same image in another spot
Do
j = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
If Pic(j) = "" Then
Pic(j) = ImgPath & ImgName
Exit Do
End If
Loop
Next i
For i = 0 To 19
Image1(i).Picture = LoadPicture(ImgPath & "CardBack.bmp")
Image1(i).BorderStyle = 0
Image1(i).Visible = True
Next i
ClickNum = 0
Me.Refresh
rvalue = PlaySound("c:\windows\medi
End Sub
Private Sub Form_Load()
ImgPath = "C:\Program Files\DevStudio\Memory Game\"
Shuffle
End Sub
Private Sub Image1_Click(Index As Integer)
Dim i As Integer
Dim rvalue As Double
' When an image is clicked, this subroutine is called
ClickNum = ClickNum + 1 ' increment the click counter
If ClickNum = 1 Then ' No clicks before the present one
Clicked(1) = Index
Image1(Index).Picture = LoadPicture(Pic(Index))
Image1(Index).BorderStyle = 1
ElseIf ClickNum = 2 Then
If Index = Clicked(1) Then ' Same image clicked twice
ClickNum = 1
Exit Sub
End If
Clicked(2) = Index
Image1(Index).Picture = LoadPicture(Pic(Index))
Image1(Index).BorderStyle = 1
Me.Refresh
If Pic(Clicked(1)) = Pic(Clicked(2)) Then
rvalue = PlaySound("c:\windows\medi
Success Clicked(1), Clicked(2)
Else
rvalue = PlaySound("c:\windows\medi
For i = 0 To 19
Image1(i).Picture = LoadPicture(ImgPath & "CardBack.bmp")
Image1(i).BorderStyle = 0
Next i
Me.Refresh
End If
ClickNum = 0 ' reset click counter
End If
End Sub
Private Sub Success(img1 As Integer, img2 As Integer)
Dim i As Integer
Dim rvalue As Long
' Values for img1 and img2 are passed to the subroutine
' The two images are then "turned off"
Image1(img1).Visible = False
Image1(img2).Visible = False
Me.Refresh
' Play the whoosh sound
rvalue = PlaySound("c:\windows\medi
' If any images left, go back and continue play
For i = 0 To 19
If Image1(i).Visible = True Then Exit Sub
Next i
' Otherwise, play the applause sound and reset the game
rvalue = PlaySound("c:\windows\medi
Shuffle
End Sub
Private Sub Command1_Click() ' Reset button
Shuffle
End Sub
ASKER
You are too much hddp666 ! I really appreciate the extra code above. I have a friend who works with me and he will be coming to this area of cyber space real soon. He will be Pointing a Question to you if its O.K. He likes the Match Code and will be asking you How To Change The Pictures so that there will be Sets of Pictures instead of just the 20. Like if you wanted Three Sets Of Pictures. It will be worth 200 points.
Thank You Again...
Thank You Again...
ASKER