Hey I have a blackjack game and I am unsure on how to set the values of the cards can anyone help?
[CODE=vb]Option Explicit
Const NumItems As Integer = 53
Public Sub RandomizeCards( )
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim l As Integer
Dim m As Integer
Dim n As Integer
Dim o As Integer
Dim p As Integer
Dim tmp As Integer
Dim Count As Integer
imgUser(2).Visi ble = False
imgUser(3).Visi ble = False
imgUser1(2).Vis ible = False
imgUser1(3).Vis ible = False
' Randomize the array.
Randomize
For Count = 1 To NumItems - 1
' Pick a random entry.
j = Int((Rnd * 53) + 1)
i = Int((Rnd * 53) + 1)
k = Int((Rnd * 53) + 1)
l = Int((Rnd * 53) + 1)
m = Int((Rnd * 53) + 1)
n = Int((Rnd * 53) + 1)
o = Int((Rnd * 53) + 1)
p = Int((Rnd * 53) + 1)
' Swap the numbers.
'imgCards(tmp) = imgCards(j)
'imgCards(j) = imgCards(i)
'imgCards(i) = imgCards(tmp)
Next Count
'Player one cards
imgUser(0) = imgCards(j)
imgUser(1) = imgCards(i)
imgUser(2) = imgCards(k)
imgUser(3) = imgCards(l)
'Player two cards
imgUser1(0) = imgCards(m)
imgUser1(1) = imgCards(n)
imgUser1(2) = imgCards(o)
imgUser1(3) = imgCards(p)
End Sub
Private Sub cmdDeal_Click()
RandomizeCards
cmdDeal.Visible = False
cmdTwist.Visibl e = True
cmdStick.Visibl e = True
cmdTwist1.Visib le = True
cmdStick1.Visib le = True
End Sub
Private Sub cmdStick_Click( )
End
End Sub
Private Sub cmdStick1_Click ()
End
End Sub
Private Sub cmdTwist_Click( )
If imgUser(0) And imgUser(1) <= 100 Then
imgUser(2).Visi ble = True
End If
'imgUser(2).Vis ible = True
'imgUser(3).Vis ible = True
End Sub
Private Sub cmdTwist1_Click ()
imgUser1(2).Vis ible = True
imgUser1(3).Vis ible = True
End Sub
Private Sub Form_Load()
cmdTwist.Visibl e = False
cmdStick.Visibl e = False
cmdTwist1.Visib le = False
cmdStick1.Visib le = False
End Sub[/CODE]
Any Ideas?
[CODE=vb]Option Explicit
Const NumItems As Integer = 53
Public Sub RandomizeCards( )
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim l As Integer
Dim m As Integer
Dim n As Integer
Dim o As Integer
Dim p As Integer
Dim tmp As Integer
Dim Count As Integer
imgUser(2).Visi ble = False
imgUser(3).Visi ble = False
imgUser1(2).Vis ible = False
imgUser1(3).Vis ible = False
' Randomize the array.
Randomize
For Count = 1 To NumItems - 1
' Pick a random entry.
j = Int((Rnd * 53) + 1)
i = Int((Rnd * 53) + 1)
k = Int((Rnd * 53) + 1)
l = Int((Rnd * 53) + 1)
m = Int((Rnd * 53) + 1)
n = Int((Rnd * 53) + 1)
o = Int((Rnd * 53) + 1)
p = Int((Rnd * 53) + 1)
' Swap the numbers.
'imgCards(tmp) = imgCards(j)
'imgCards(j) = imgCards(i)
'imgCards(i) = imgCards(tmp)
Next Count
'Player one cards
imgUser(0) = imgCards(j)
imgUser(1) = imgCards(i)
imgUser(2) = imgCards(k)
imgUser(3) = imgCards(l)
'Player two cards
imgUser1(0) = imgCards(m)
imgUser1(1) = imgCards(n)
imgUser1(2) = imgCards(o)
imgUser1(3) = imgCards(p)
End Sub
Private Sub cmdDeal_Click()
RandomizeCards
cmdDeal.Visible = False
cmdTwist.Visibl e = True
cmdStick.Visibl e = True
cmdTwist1.Visib le = True
cmdStick1.Visib le = True
End Sub
Private Sub cmdStick_Click( )
End
End Sub
Private Sub cmdStick1_Click ()
End
End Sub
Private Sub cmdTwist_Click( )
If imgUser(0) And imgUser(1) <= 100 Then
imgUser(2).Visi ble = True
End If
'imgUser(2).Vis ible = True
'imgUser(3).Vis ible = True
End Sub
Private Sub cmdTwist1_Click ()
imgUser1(2).Vis ible = True
imgUser1(3).Vis ible = True
End Sub
Private Sub Form_Load()
cmdTwist.Visibl e = False
cmdStick.Visibl e = False
cmdTwist1.Visib le = False
cmdStick1.Visib le = False
End Sub[/CODE]
Any Ideas?
Comment