Dim cardOne As Integer 'Memory Game Copyright 2015 by Robert Dukish
Dim cardTwo As Integer 'The objective is to exercise a person's memory
Dim cardThree As Integer 'by memorizing color squares and finding them when hidden
Dim cardFour As Integer
Dim cardFive As Integer
Dim cardSix As Integer
Dim cardSeven As Integer
Dim cardEight As Integer
Dim counter As Integer
Dim matches As Integer
Dim color As Integer
Dim red As Integer
Dim green As Integer
Dim blue As Integer
Dim yellow As Integer
Dim x As String
Dim y As Integer
Dim Pic1 As Integer
Dim Pic2 As Integer
Dim Pic3 As Integer
Dim Pic4 As Integer
Dim Pic5 As Integer
Dim Pic6 As Integer
Dim Pic7 As Integer
Dim Pic8 As Integer
Dim cardOneSelect As Integer
Dim cardTwoSelect As Integer
Dim cardThreeSelect As Integer
Dim cardFourSelect As Integer
Dim cardFiveSelect As Integer
Dim cardSixSelect As Integer
Dim cardSevenSelect As Integer
Dim cardEightSelect As Integer
Dim cardOnePickedColor As Integer
Dim cardTwoPickedColor As Integer
Dim cardThreePickedColor As Integer
Dim cardFourPickedColor As Integer
Dim cardFivePickedColor As Integer
Dim cardSixPickedColor As Integer
Dim cardSevenPickedColor As Integer
Dim cardEightPickedColor As Integer
Dim GameCounter As Integer
Dim totalMatches As Integer
Dim totalPoints As Integer
Dim roundPoints As Integer
Private Sub cmdAbout_Click()
MsgBox "Click memorize, then Hide and match the squares. After 10 rounds, Reset starts a new game", vbInformation, "Memory Game Help"
End Sub
Private Sub cmdMemorize_Click() 'generate random numbers and assign colors to each card
GameCounter = GameCounter + 1
red = 0
green = 0
blue = 0
yellow = 0
cardOne = 0
cardTwo = 0
cardThree = 0
cardFour = 0
cardFive = 0
cardSix = 0
cardSeven = 0
cardEight = 0
cardOneSelect = 0
cardTwoSelect = 0
cardThreeSelect = 0
cardFourSelect = 0
cardFiveSelect = 0
cardSixSelect = 0
cardSevenSelect = 0
cardEightSelect = 0
cmd1.Caption = "1"
cmd2.Caption = "2"
cmd3.Caption = "3"
cmd4.Caption = "4"
cmd5.Caption = "5"
cmd6.Caption = "6"
cmd7.Caption = "7"
cmd8.Caption = "8"
If GameCounter > 10 Then
Label1 = "Reset for New Game"
WindowsMediaPlayer1.URL = "C:\vb\chimes.wav"
Else
roundPoints = roundPoints + matches
matches = 0 'display information
counter = 0
Text1.Text = "New Round"
Label1 = "Round " & GameCounter & " of 10"
Do Until red = 2 And green = 2 And blue = 2 And yellow = 2
Randomize Timer 'loop until two of each color cards are picked
cardOne = Int(Rnd * 4)
cardTwo = Int(Rnd * 4)
cardThree = Int(Rnd * 4)
cardFour = Int(Rnd * 4)
cardFive = Int(Rnd * 4)
cardSix = Int(Rnd * 4)
cardSeven = Int(Rnd * 4)
cardEight = Int(Rnd * 4)
If cardOneSelect < 1 And cardOne = 0 And red < 2 Then
Pic1 = 1 'Determines card
red = red + 1 'Allows only two color cards to appear
cardOneSelect = 1 'locks out card
cardOnePickedColor = cardOne 'sends color information to specific card
ElseIf cardOneSelect < 1 And cardOne = 1 And green < 2 Then
Pic1 = 2
green = green + 1
cardOneSelect = 1
cardOnePickedColor = cardOne
ElseIf cardOneSelect < 1 And cardOne = 2 And blue < 2 Then
Pic1 = 3
blue = blue + 1
cardOneSelect = 1
cardOnePickedColor = cardOne
ElseIf cardOneSelect < 1 And cardOne = 3 And yellow < 2 Then
Pic1 = 4
yellow = yellow + 1
cardOneSelect = 1
cardOnePickedColor = cardOne
Else: y = 1
End If
If cardTwoSelect < 1 And cardTwo = 0 And red < 2 Then
Pic2 = 1
red = red + 1
cardTwoSelect = 1
cardTwoPickedColor = cardTwo
ElseIf cardTwoSelect < 1 And cardTwo = 1 And green < 2 Then
Pic2 = 2
green = green + 1
cardTwoSelect = 1
cardTwoPickedColor = cardTwo
ElseIf cardTwoSelect < 1 And cardTwo = 2 And blue < 2 Then
Pic2 = 3
blue = blue + 1
cardTwoSelect = 1
cardTwoPickedColor = cardTwo
ElseIf cardTwoSelect < 1 And cardTwo = 3 And yellow < 2 Then
Pic2 = 4
yellow = yellow + 1
cardTwoSelect = 1
cardTwoPickedColor = cardTwo
Else: y = 1
End If
If cardThreeSelect < 1 And cardThree = 0 And red < 2 Then
Pic3 = 1
red = red + 1
cardThreeSelect = 1
cardThreePickedColor = cardThree
ElseIf cardThreeSelect < 1 And cardThree = 1 And green < 2 Then
Pic3 = 2
green = green + 1
cardThreeSelect = 1
cardThreePickedColor = cardThree
ElseIf cardThreeSelect < 1 And cardThree = 2 And blue < 2 Then
Pic3 = 3
blue = blue + 1
cardThreeSelect = 1
cardThreePickedColor = cardThree
ElseIf cardThreeSelect < 1 And cardThree = 3 And yellow < 2 Then
Pic3 = 4
yellow = yellow + 1
cardThreeSelect = 1
cardThreePickedColor = cardThree
Else: y = 1
End If
If cardFourSelect < 1 And cardFour = 0 And red < 2 Then
Pic4 = 1
red = red + 1
cardFourSelect = 1
cardFourPickedColor = cardFour
ElseIf cardFourSelect < 1 And cardFour = 1 And green < 2 Then
Pic4 = 2
green = green + 1
cardFourSelect = 1
cardFourPickedColor = cardFour
ElseIf cardFourSelect < 1 And cardFour = 2 And blue < 2 Then
Pic4 = 3
blue = blue + 1
cardFourSelect = 1
cardFourPickedColor = cardFour
ElseIf cardFourSelect < 1 And cardFour = 3 And yellow < 2 Then
Pic4 = 4
yellow = yellow + 1
cardFourSelect = 1
cardFourPickedColor = cardFour
Else: y = 1
End If
If cardFiveSelect < 1 And cardFive = 0 And red < 2 Then
Pic5 = 1
red = red + 1
cardFiveSelect = 1
cardFivePickedColor = cardFive
ElseIf cardFiveSelect < 1 And cardFive = 1 And green < 2 Then
Pic5 = 2
green = green + 1
cardFiveSelect = 1
cardFivePickedColor = cardFive
ElseIf cardFiveSelect < 1 And cardFive = 2 And blue < 2 Then
Pic5 = 3
blue = blue + 1
cardFiveSelect = 1
cardFivePickedColor = cardFive
ElseIf cardFiveSelect < 1 And cardFive = 3 And yellow < 2 Then
Pic5 = 4
yellow = yellow + 1
cardFiveSelect = 1
cardFivePickedColor = cardFive
Else: y = 1
End If
If cardSixSelect < 1 And cardSix = 0 And red < 2 Then
Pic6 = 1
red = red + 1
cardSixSelect = 1
cardSixPickedColor = cardSix
ElseIf cardSixSelect < 1 And cardSix = 1 And green < 2 Then
Pic6 = 2
green = green + 1
cardSixSelect = 1
cardSixPickedColor = cardSix
ElseIf cardSixSelect < 1 And cardSix = 2 And blue < 2 Then
Pic6 = 3
blue = blue + 1
cardSixSelect = 1
cardSixPickedColor = cardSix
ElseIf cardSixSelect < 1 And cardSix = 3 And yellow < 2 Then
Pic6 = 4
yellow = yellow + 1
cardSixSelect = 1
cardSixPickedColor = cardSix
Else: y = 1
End If
If cardSevenSelect < 1 And cardSeven = 0 And red < 2 Then
Pic7 = 1
red = red + 1
cardSevenSelect = 1
cardSevenPickedColor = cardSeven
ElseIf cardSevenSelect < 1 And cardSeven = 1 And green < 2 Then
Pic7 = 2
green = green + 1
cardSevenSelect = 1
cardSevenPickedColor = cardSeven
ElseIf cardSevenSelect < 1 And cardSeven = 2 And blue < 2 Then
Pic7 = 3
blue = blue + 1
cardSevenSelect = 1
cardSevenPickedColor = cardSeven
ElseIf cardSevenSelect < 1 And cardSeven = 3 And yellow < 2 Then
Pic7 = 4
yellow = yellow + 1
cardSevenSelect = 1
cardSevenPickedColor = cardSeven
Else: y = 1
End If
If cardEightSelect < 1 And cardEight = 0 And red < 2 Then
Pic8 = 1
red = red + 1
cardEightSelect = 1
cardEightPickedColor = cardEight
ElseIf cardEightSelect < 1 And cardEight = 1 And green < 2 Then
Pic8 = 2
green = green + 1
cardEightSelect = 1
cardEightPickedColor = cardEight
ElseIf cardEightSelect < 1 And cardEight = 2 And blue < 2 Then
Pic8 = 3
blue = blue + 1
cardEightSelect = 1
cardEightPickedColor = cardEight
ElseIf cardEightSelect < 1 And cardEight = 3 And yellow < 2 Then
Pic8 = 4
yellow = yellow + 1
cardEightSelect = 1
cardEightPickedColor = cardEight
Else: y = 1
End If
Loop
Select Case Pic1 'turns color information to color and lables it
Case 1
picture1.Picture = LoadPicture("C:\vb\red.bmp")
Case 2
picture1.Picture = LoadPicture("C:\vb\green.bmp")
Case 3
picture1.Picture = LoadPicture("C:\vb\blue.bmp")
Case 4
picture1.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
Select Case Pic2
Case 1
picture2.Picture = LoadPicture("C:\vb\red.bmp")
Case 2
picture2.Picture = LoadPicture("C:\vb\green.bmp")
Case 3
picture2.Picture = LoadPicture("C:\vb\blue.bmp")
Case 4
picture2.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
Select Case Pic3
Case 1
picture3.Picture = LoadPicture("C:\vb\red.bmp")
Case 2
picture3.Picture = LoadPicture("C:\vb\green.bmp")
Case 3
picture3.Picture = LoadPicture("C:\vb\blue.bmp")
Case 4
picture3.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
Select Case Pic4
Case 1
picture4.Picture = LoadPicture("C:\vb\red.bmp")
Case 2
picture4.Picture = LoadPicture("C:\vb\green.bmp")
Case 3
picture4.Picture = LoadPicture("C:\vb\blue.bmp")
Case 4
picture4.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
Select Case Pic5
Case 1
picture5.Picture = LoadPicture("C:\vb\red.bmp")
Case 2
picture5.Picture = LoadPicture("C:\vb\green.bmp")
Case 3
picture5.Picture = LoadPicture("C:\vb\blue.bmp")
Case 4
picture5.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
Select Case Pic6
Case 1
picture6.Picture = LoadPicture("C:\vb\red.bmp")
Case 2
picture6.Picture = LoadPicture("C:\vb\green.bmp")
Case 3
picture6.Picture = LoadPicture("C:\vb\blue.bmp")
Case 4
picture6.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
Select Case Pic7
Case 1
picture7.Picture = LoadPicture("C:\vb\red.bmp")
Case 2
picture7.Picture = LoadPicture("C:\vb\green.bmp")
Case 3
picture7.Picture = LoadPicture("C:\vb\blue.bmp")
Case 4
picture7.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
Select Case Pic8
Case 1
picture8.Picture = LoadPicture("C:\vb\red.bmp")
Case 2
picture8.Picture = LoadPicture("C:\vb\green.bmp")
Case 3
picture8.Picture = LoadPicture("C:\vb\blue.bmp")
Case 4
picture8.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
End If
End Sub
Private Sub cmdPlay_Click()
picture1.Picture = LoadPicture("C:\vb\black.bmp") 'hide colors and zero counter
picture2.Picture = LoadPicture("C:\vb\black.bmp")
picture3.Picture = LoadPicture("C:\vb\black.bmp")
picture4.Picture = LoadPicture("C:\vb\black.bmp")
picture5.Picture = LoadPicture("C:\vb\black.bmp")
picture6.Picture = LoadPicture("C:\vb\black.bmp")
picture7.Picture = LoadPicture("C:\vb\black.bmp")
picture8.Picture = LoadPicture("C:\vb\black.bmp")
Text1 = "Points = " & Str(matches)
counter = 0
End Sub
Private Sub cmd1_Click()
If counter = 0 And cardOnePickedColor < 10 Then 'Checks for first click and picks color to match
color = cardOnePickedColor
Select Case cardOnePickedColor
Case 0
picture1.Picture = LoadPicture("C:\vb\red.bmp")
x = "RED"
Case 1
picture1.Picture = LoadPicture("C:\vb\green.bmp")
x = "GREEN"
Case 2
picture1.Picture = LoadPicture("C:\vb\blue.bmp")
x = "BLUE"
Case 3
picture1.Picture = LoadPicture("C:\vb\yellow.bmp")
x = "Yellow"
End Select
Label1 = "Looking for " & (x)
cmd1.Caption = "Picked"
counter = counter + 1
Else 'Checks for a winning match
WindowsMediaPlayer1.URL = "C:\vb\chimes.wav"
cmd1.Caption = "Picked"
If color = cardOnePickedColor Then
Select Case cardOnePickedColor
Case 0
picture1.Picture = LoadPicture("C:\vb\red.bmp")
Case 1
picture1.Picture = LoadPicture("C:\vb\green.bmp")
Case 2
picture1.Picture = LoadPicture("C:\vb\blue.bmp")
Case 3
picture1.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
matches = matches + 1
Text1 = "Points = " & Str(matches)
totalPoints = roundPoints + matches
Text2 = "Total Points = " & Str(totalPoints)
Label1 = "Got It"
counter = 0
Else: WindowsMediaPlayer1.URL = "C:\vb\chord.wav" 'no match loses
Select Case cardOnePickedColor
Case 0
picture1.Picture = LoadPicture("C:\vb\red.bmp")
Case 1
picture1.Picture = LoadPicture("C:\vb\green.bmp")
Case 2
picture1.Picture = LoadPicture("C:\vb\blue.bmp")
Case 3
picture1.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
End If
End If
cardOnePickedColor = 10 'lockout setting the card to 10 and incrementing for each card
End Sub
Private Sub cmd2_Click()
If counter = 0 And cardTwoPickedColor < 10 Then
color = cardTwoPickedColor
Select Case cardTwoPickedColor
Case 0
picture2.Picture = LoadPicture("C:\vb\red.bmp")
x = "RED"
Case 1
picture2.Picture = LoadPicture("C:\vb\green.bmp")
x = "GREEN"
Case 2
picture2.Picture = LoadPicture("C:\vb\blue.bmp")
x = "BLUE"
Case 3
picture2.Picture = LoadPicture("C:\vb\yellow.bmp")
x = "YELLOW"
End Select
Label2 = "Looking for " & x
cmd2.Caption = "Picked"
counter = counter + 1
Else
WindowsMediaPlayer1.URL = "C:\vb\chimes.wav"
cmd2.Caption = "Picked"
If color = cardTwoPickedColor Then
Select Case cardTwoPickedColor
Case 0
picture2.Picture = LoadPicture("C:\vb\red.bmp")
Case 1
picture2.Picture = LoadPicture("C:\vb\green.bmp")
Case 2
picture2.Picture = LoadPicture("C:\vb\blue.bmp")
Case 3
picture2.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
matches = matches + 1
Text1 = "Points = " & Str(matches)
totalPoints = roundPoints + matches
Text2 = "Total Points = " & Str(totalPoints)
Label1 = "Winner"
counter = 0
Else: WindowsMediaPlayer1.URL = "C:\vb\chord.wav"
Select Case cardTwoPickedColor
Case 0
picture2.Picture = LoadPicture("C:\vb\red.bmp")
Case 1
picture2.Picture = LoadPicture("C:\vb\green.bmp")
Case 2
picture2.Picture = LoadPicture("C:\vb\blue.bmp")
Case 3
picture2.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
End If
End If
cardTwoPickedColor = 11
End Sub
Private Sub cmd3_Click()
If counter = 0 And cardThreePickedColor < 10 Then
color = cardThreePickedColor
Select Case cardThreePickedColor
Case 0
picture3.Picture = LoadPicture("C:\vb\red.bmp")
x = "RED"
Case 1
picture3.Picture = LoadPicture("C:\vb\green.bmp")
x = "GREEN"
Case 2
picture3.Picture = LoadPicture("C:\vb\blue.bmp")
x = "BLUE"
Case 3
picture3.Picture = LoadPicture("C:\vb\yellow.bmp")
x = "yellow"
End Select
Label1 = "Looking for " & x
cmd3.Caption = "Picked"
counter = counter + 1
Else
WindowsMediaPlayer1.URL = "C:\vb\chimes.wav"
cmd3.Caption = "Picked"
If cardThreePickedColor = color Then
Select Case cardThreePickedColor
Case 0
picture3.Picture = LoadPicture("C:\vb\red.bmp")
Case 1
picture3.Picture = LoadPicture("C:\vb\green.bmp")
Case 2
picture3.Picture = LoadPicture("C:\vb\blue.bmp")
Case 3
picture3.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
matches = matches + 1
Text1 = "Points = " & Str(matches)
totalPoints = roundPoints + matches
Text2 = "Total Points = " & Str(totalPoints)
Label1 = "That's It !"
counter = 0
Else: WindowsMediaPlayer1.URL = "C:\vb\chord.wav"
Select Case cardThreePickedColor
Case 0
picture3.Picture = LoadPicture("C:\vb\red.bmp")
Case 1
picture3.Picture = LoadPicture("C:\vb\green.bmp")
Case 2
picture3.Picture = LoadPicture("C:\vb\blue.bmp")
Case 3
picture3.Picture = LoadPicture("C:\vb\Yellow.bmp")
End Select
End If
End If
cardThreePickedColor = 12
End Sub
Private Sub cmd4_Click()
If counter = 0 And cardFourPickedColor < 10 Then
color = cardFourPickedColor
Select Case cardFourPickedColor
Case 0
picture4.Picture = LoadPicture("C:\vb\red.bmp")
x = "RED"
Case 1
picture4.Picture = LoadPicture("C:\vb\green.bmp")
x = "GREEN"
Case 2
picture4.Picture = LoadPicture("C:\vb\blue.bmp")
x = "BLUE"
Case 3
picture4.Picture = LoadPicture("C:\vb\Yellow.bmp")
x = "yellow"
End Select
Label1 = "Looking for " & x
cmd4.Caption = "Picked"
counter = counter + 1
Else
WindowsMediaPlayer1.URL = "C:\vb\chimes.wav"
cmd4.Caption = "Picked"
If cardFourPickedColor = color Then
Select Case cardFourPickedColor
Case 0
picture4.Picture = LoadPicture("C:\vb\red.bmp")
Case 1
picture4.Picture = LoadPicture("C:\vb\green.bmp")
Case 2
picture4.Picture = LoadPicture("C:\vb\blue.bmp")
Case 3
picture4.Picture = LoadPicture("C:\vb\Yellow.bmp")
End Select
matches = matches + 1
Text1 = "Points = " & Str(matches)
totalPoints = roundPoints + matches
Text2 = "Total Points = " & Str(totalPoints)
Label1 = "You Win"
counter = 0
Else: WindowsMediaPlayer1.URL = "C:\vb\chord.wav"
Select Case cardFourPickedColor
Case 0
picture4.Picture = LoadPicture("C:\vb\red.bmp")
Case 1
picture4.Picture = LoadPicture("C:\vb\green.bmp")
Case 2
picture4.Picture = LoadPicture("C:\vb\blue.bmp")
Case 3
picture4.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
End If
End If
cardFourPickedColor = 13
End Sub
Private Sub cmd5_Click()
If counter = 0 And cardFivePickedColor < 10 Then
color = cardFivePickedColor
Select Case cardFivePickedColor
Case 0
picture5.Picture = LoadPicture("C:\vb\red.bmp")
x = "RED"
Case 1
picture5.Picture = LoadPicture("C:\vb\green.bmp")
x = "GREEN"
Case 2
picture5.Picture = LoadPicture("C:\vb\blue.bmp")
x = "BLUE"
Case 3
picture5.Picture = LoadPicture("C:\vb\yellow.bmp")
x = "Yellow"
End Select
Label1 = "Looking for " & x
cmd5.Caption = "Picked"
counter = counter + 1
Else
WindowsMediaPlayer1.URL = "C:\vb\chimes.wav"
cmd5.Caption = "Picked"
If cardFivePickedColor = color Then
Select Case cardFivePickedColor
Case 0
picture5.Picture = LoadPicture("C:\vb\red.bmp")
Case 1
picture5.Picture = LoadPicture("C:\vb\green.bmp")
Case 2
picture5.Picture = LoadPicture("C:\vb\blue.bmp")
Case 3
picture5.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
matches = matches + 1
Text1 = "Points = " & Str(matches)
totalPoints = roundPoints + matches
Text2 = "Total Points = " & Str(totalPoints)
Label1 = "Another Point !"
counter = 0
Else: WindowsMediaPlayer1.URL = "C:\vb\chord.wav"
Select Case cardFivePickedColor
Case 0
picture5.Picture = LoadPicture("C:\vb\red.bmp")
Case 1
picture5.Picture = LoadPicture("C:\vb\green.bmp")
Case 2
picture5.Picture = LoadPicture("C:\vb\blue.bmp")
Case 3
picture5.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
End If
End If
cardFivePickedColor = 14
End Sub
Private Sub cmd6_Click()
If counter = 0 And cardSixPickedColor < 10 Then
color = cardSixPickedColor
Select Case cardSixPickedColor
Case 0
picture6.Picture = LoadPicture("C:\vb\red.bmp")
x = "RED"
Case 1
picture6.Picture = LoadPicture("C:\vb\green.bmp")
x = "GREEN"
Case 2
picture6.Picture = LoadPicture("C:\vb\blue.bmp")
x = "BLUE"
Case 3
picture6.Picture = LoadPicture("C:\vb\yellow.bmp")
x = "Yellow"
End Select
Label1 = "Looking for " & x
cmd6.Caption = "Picked"
counter = counter + 1
Else
WindowsMediaPlayer1.URL = "C:\vb\chimes.wav"
cmd6.Caption = "Picked"
If cardSixPickedColor = color Then
Select Case cardSixPickedColor
Case 0
picture6.Picture = LoadPicture("C:\vb\red.bmp")
Case 1
picture6.Picture = LoadPicture("C:\vb\green.bmp")
Case 2
picture6.Picture = LoadPicture("C:\vb\blue.bmp")
Case 3
picture6.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
matches = matches + 1
Text1 = "Points = " & Str(matches)
totalPoints = roundPoints + matches
Text2 = "Total Points = " & Str(totalPoints)
Label1 = "Good Pick"
counter = 0
Else: WindowsMediaPlayer1.URL = "C:\vb\chord.wav"
Select Case cardSixPickedColor
Case 0
picture6.Picture = LoadPicture("C:\vb\red.bmp")
Case 1
picture6.Picture = LoadPicture("C:\vb\green.bmp")
Case 2
picture6.Picture = LoadPicture("C:\vb\blue.bmp")
Case 3
picture6.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
End If
End If
cardSixPickedColor = 15
End Sub
Private Sub cmd7_Click()
If counter = 0 And cardSevenPickedColor < 10 Then
color = cardSevenPickedColor
Select Case cardSevenPickedColor
Case 0
picture7.Picture = LoadPicture("C:\vb\red.bmp")
x = "RED"
Case 1
picture7.Picture = LoadPicture("C:\vb\green.bmp")
x = "GREEN"
Case 2
picture7.Picture = LoadPicture("C:\vb\blue.bmp")
x = "BLUE"
Case 3
picture7.Picture = LoadPicture("C:\vb\yellow.bmp")
x = "YELLOW"
End Select
Label1 = "Looking for " & x
cmd7.Caption = "Picked"
counter = counter + 1
Else
WindowsMediaPlayer1.URL = "C:\vb\chimes.wav"
cmd7.Caption = "Picked"
If cardSevenPickedColor = color Then
Select Case cardSevenPickedColor
Case 0
picture7.Picture = LoadPicture("C:\vb\red.bmp")
Case 1
picture7.Picture = LoadPicture("C:\vb\green.bmp")
Case 2
picture7.Picture = LoadPicture("C:\vb\blue.bmp")
Case 3
picture7.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
matches = matches + 1
Text1 = "Points = " & Str(matches)
totalPoints = roundPoints + matches
Text2 = "Total Points = " & Str(totalPoints)
Label1 = "Great Job !"
counter = 0
Else: WindowsMediaPlayer1.URL = "C:\vb\chord.wav"
Select Case cardSevenPickedColor
Case 0
picture7.Picture = LoadPicture("C:\vb\red.bmp")
Case 1
picture7.Picture = LoadPicture("C:\vb\green.bmp")
Case 2
picture7.Picture = LoadPicture("C:\vb\blue.bmp")
Case 3
picture7.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
End If
End If
cardSevenPickedColor = 16
End Sub
Private Sub cmd8_Click()
If counter = 0 And cardEightPickedColor < 10 Then
color = cardEightPickedColor
Select Case cardEightPickedColor
Case 0
picture8.Picture = LoadPicture("C:\vb\red.bmp")
x = "RED"
Case 1
picture8.Picture = LoadPicture("C:\vb\green.bmp")
x = "GREEN"
Case 2
picture8.Picture = LoadPicture("C:\vb\blue.bmp")
x = "BLUE"
Case 3
picture8.Picture = LoadPicture("C:\vb\yellow.bmp")
x = "YELLOW"
End Select
Label1 = "Looking for " & x
cmd8.Caption = "Picked"
counter = counter + 1
Else
WindowsMediaPlayer1.URL = "C:\vb\chimes.wav"
cmd8.Caption = "Picked"
If cardEightPickedColor = color Then
Select Case cardEightPickedColor
Case 0
picture8.Picture = LoadPicture("C:\vb\red.bmp")
Case 1
picture8.Picture = LoadPicture("C:\vb\green.bmp")
Case 2
picture8.Picture = LoadPicture("C:\vb\blue.bmp")
Case 3
picture8.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
matches = matches + 1
Text1 = "Points = " & Str(matches)
totalPoints = roundPoints + matches
Text2 = "Total Points = " & Str(totalPoints)
Label1 = "Win !"
counter = 0
Else: WindowsMediaPlayer1.URL = "C:\vb\chord.wav"
Select Case cardEightPickedColor
Case 0
picture8.Picture = LoadPicture("C:\vb\red.bmp")
Case 1
picture8.Picture = LoadPicture("C:\vb\green.bmp")
Case 2
picture8.Picture = LoadPicture("C:\vb\blue.bmp")
Case 3
picture8.Picture = LoadPicture("C:\vb\yellow.bmp")
End Select
End If
End If
cardEightPickedColor = 17
End Sub
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdReset_Click()
picture1.Picture = LoadPicture("C:\vb\black.bmp") 'hide colors and zero counter
picture2.Picture = LoadPicture("C:\vb\black.bmp")
picture3.Picture = LoadPicture("C:\vb\black.bmp")
picture4.Picture = LoadPicture("C:\vb\black.bmp")
picture5.Picture = LoadPicture("C:\vb\black.bmp")
picture6.Picture = LoadPicture("C:\vb\black.bmp")
picture7.Picture = LoadPicture("C:\vb\black.bmp")
picture8.Picture = LoadPicture("C:\vb\black.bmp")
GameCounter = 0
matches = 0
totalPoints = 0
roundPoints = 0
totalMatches = 0
Label1 = "New Game"
Text1 = "Press Memorize"
Text2 = "Start New Game"
End Sub