VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Dice Game 2.0- This Dice Game is basically Yatzee it is very fine and works fantastically.

by Dabawig (3 Submissions)
Category: Games
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Mon 26th April 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Dice Game 2.0- This Dice Game is basically Yatzee it is very fine and works fantastically.

API Declarations


KEEP commandbutton
Label1 Label
Label2 Label
Label3 Label
Label4 Label
Label5 Label
R1 Textbox
R2 textbox
R3 textbox
Reroll commandbutton
Roll commandbutton
round textbox
scoreb textbox

Rate Dice Game 2.0- This Dice Game is basically Yatzee it is very fine and works fantastically.



Dim r As Integer
Dim rr As Integer
Dim score As Integer
Dim rou As Integer
Private Sub Form_Load()
rno = 1
Randomize Timer
keep.Enabled = False
reroll.Enabled = False
rr = 0
rou = 1
round.Text = rou

End Sub

Private Sub keep_Click()
roll.Enabled = True
keep.Enabled = False
reroll.Enabled = False
If rno = 4 Then

  MsgBox "Round Over!"
 If CInt(r1.Text) = CInt(r2.Text) And CInt(r2.Text) = CInt(r3.Text) Then
      score = score + 21
 Else
      score = score + CInt(r1.Text) + CInt(r2.Text) + CInt(r3.Text)
 End If
    
  scoreb.Text = score
  
  rno = 1
  rr = 0
 
  rou = rou + 1
  round.Text = rou
  If rou = 10 Then
      MsgBox "Game"
      End

  End If
End If

End Sub

Private Sub reroll_Click()
rr = rr + 1
If rno = 2 Then
rno = 1
reroll.Enabled = False
keep.Enabled = False
roll.Enabled = True
ElseIf rno = 3 Then
rno = 2
reroll.Enabled = False
keep.Enabled = False
roll.Enabled = True
ElseIf rno = 4 Then
rno = 3
reroll.Enabled = False
keep.Enabled = False
roll.Enabled = True
End If
End Sub

Private Sub roll_Click()
r = Int(Rnd * 6) + 1

If rno = 1 Then
r1.Text = r

rno = 2
roll.Enabled = False
keep.Enabled = True
If rr < 4 Then
reroll.Enabled = True
End If
ElseIf rno = 2 Then
r2.Text = r

rno = 3
roll.Enabled = False
keep.Enabled = True
If rr < 4 Then
reroll.Enabled = True
End If
ElseIf rno = 3 Then
r3.Text = r

roll.Enabled = False
keep.Enabled = True
If rr < 4 Then
reroll.Enabled = True
End If
rno = 4

End If

End Sub


Download this snippet    Add to My Saved Code

Dice Game 2.0- This Dice Game is basically Yatzee it is very fine and works fantastically. Comments

No comments have been posted about Dice Game 2.0- This Dice Game is basically Yatzee it is very fine and works fantastically.. Why not be the first to post a comment about Dice Game 2.0- This Dice Game is basically Yatzee it is very fine and works fantastically..

Post your comment

Subject:
Message:
0/1000 characters