vb小游戏源代码
Dim pFist, cFist, cCount, pCount, dCount, tCount As Integer
Private Sub Form_Load()
cCount = 0
pCount = 0
dCount = 0
tCount = 1
lblPWinNum.Caption =
lblPWinNum.Caption = lblPWinNum.Caption & pCount
lblCWinNum.Caption =
lblCWinNum.Caption = lblCWinNum.Caption & cCount
lblDrawNum.Caption =
lblDrawNum.Caption = lblDrawNum.Caption & dCount
lblTotalNum.Caption =
lblTotalNum.Caption = lblTotalNum.Caption & tCount
End Sub
Private Sub imgCloth_Click()
pFist = 3
cFist = Int(Rnd * 3) + 1
txtPlayer.Text =
txtPlayer.Text = txtPlayer.Text & 布
If cFist = 1 Then
txtComputer =
txtComputer = txtComputer & 石头
Else
If cFist = 2 Then
txtComputer =
txtComputer = txtComputer & 剪刀
Else
If cFist = 3 Then
txtComputer =
txtComputer = txtComputer & 布
End If
End If
End If
If cFist = 1 Then
pCount = pCount + 1
lblPWinNum.Caption =
lblPWinNum.Caption = lblPWinNum.Caption & pCount
picSusess.Visible = True
MsgBox 恭喜你,你赢了!
Else
If cFist = 2 Then
cCount = cCount + 1
lblCWinNum.Caption =
lblCWinNum.Caption = lblCWinNum.Caption & cCount
MsgBox 很遗憾,你输了!
Else
dCount = dCount + 1
lblDrawNum.Caption =
lblDrawNum.Caption = lblDrawNum.Caption & dCount
MsgBox 打平了!
End If
End If
tCount = tCount + 1
lblTotalNum.Caption =
lblTotalNum.Caption = lblTotalNum.Caption & tCount
End Sub
Private Sub imgScissors_Click()
pFist = 2
cFist = Int(Rnd * 3) + 1
txtPlayer.Text =
txtPlayer.Text = txtPlayer.Text & 剪刀
If cFist = 1 Then
txtComputer =
txtComputer = txtComputer & 石头
Else
If cFist = 2 Then
txtComputer =
txtComputer = txtComputer & 剪刀
Else
If cFist = 3 Then
txtComputer =
txtComputer = txtComputer & 布
End If
End If
End If
If cFist = 3 Then
pCount = pCount + 1
lblPWinNum.Caption =
lblPWinNum.Caption = lblPWinNum.Caption & pCount
picSusess.Visible = True
MsgBox 恭喜你,你赢了!
Else
If cFist = 1 Then
cCount = cCount + 1
lblCWinNum.Caption =
lblCWinNum.Caption = lblCWinNum.Caption & cCount
MsgBox 很遗憾,你输了!
Else
dCount = dCount + 1
lblDrawNum.Caption =
lblDrawNum.Caption = lblDrawNum.Caption & dCount
MsgBox 打平了!
End If
End If
tCount = tCount + 1
lblTotalNum.Caption =
lblTotalNum.Caption = lblTotalNum.Caption & tCount
End Sub
Private Sub imgStone_Click()
pFist = 1
cFist = Int(Rnd * 3) + 1
txtPlayer.Text =
txtPlayer.Text = txtPlayer.Text & 石头
If cFist = 1 Then
txtComputer =
txtComputer = txtComputer & 石头
Else
If cFist = 2 Then
txtComputer =
txtComputer = txtComputer & 剪刀
Else
If cFist = 3 Then
txtComputer =
txtComputer = txtComputer & 布
End If
End If
End If
If cFist = 2 Then
pCount = pCount + 1
lblPWinNum.Caption =
lblPWinNum.Caption = lblPWinNum.Caption & pCount
picSusess.Visible = True
MsgBox 恭喜你,你赢了!
Else
If cFist = 3 Then
cCount = cCount + 1
lblCWinNum.Caption =
lblCWinNum.Caption = lblCWinNum.Caption & cCount
MsgBox 很遗憾,你输了!
Else
dCount = dCount + 1
lblDrawNum.Caption =
lblDrawNum.Caption = lblDrawNum.Caption & dCount
MsgBox 打平了!
End If
End If
tCount = tCount + 1
lblTotalNum.Caption =
lblTotalNum.Caption = lblTotalNum.Caption & tCount
End Sub
Private Sub picSusess_Click()
picSusess.Visible = False
End Sub
我原来做的一个,按照你的提示加了一个图片,picSusess这个就是图片,里面放着一个苹果的图片,当你赢了就会出现,你点击一下,那个图片就消失,我这个里面除了你这个功能,还有战绩提示,统计你胜负平的局数和第多少局(计算公式是胜负平的局数+1,就是当前局数)