用VB制作一个剪刀石头布游戏
谁会想做一个剪刀石头布的游戏,没什么要求,就是如果赢了或输或平手都显示一张搞笑的图片就可以了,谁能帮我做做啊???...
谁会想做一个剪刀石头布的游戏,没什么要求,就是如果赢了或输或平手都显示一张搞笑的图片就可以了,谁能帮我做做啊???
展开
2个回答
2013-05-26
展开全部
两个LABEL 三个COMMAND 复制代码,就可以了
'-1石头
'0剪刀
'1布
Private Sub Command1_Click()
Dim a, b As Integer
Randomize
a = -1
b = Int(Rnd * (-3) + 2)
Label1.Caption = "石头"
Select Case a - b
Case -2: Label2.Caption = "布": MsgBox "电脑胜"
Case 0: Label2.Caption = "石头": MsgBox "平"
Case -1: Label2.Caption = "剪刀": MsgBox "玩家胜"
End Select
End Sub
Private Sub Command2_Click()
Dim a, b As Integer
Randomize
a = 0
b = Int(Rnd * (-3) + 2)
Label1.Caption = "剪刀"
Select Case a - b
Case 1: Label2.Caption = "布": MsgBox "玩家胜"
Case 0: Label2.Caption = "剪刀": MsgBox "平"
Case -1: Label2.Caption = "石头": MsgBox "电脑胜"
End Select
End Sub
Private Sub Command3_Click()
Dim a, b As Integer
Randomize
a = 1
b = Int(Rnd * (-3) + 2)
Label1.Caption = "布"
Select Case a - b
Case 2: Label2.Caption = "石头": MsgBox "玩家胜"
Case 0: Label2.Caption = "布": MsgBox "平"
Case 1: Label2.Caption = "剪刀": MsgBox "电脑胜"
End Select
End Sub
Private Sub Form_Load()
Command1.Caption = "石头"
Command2.Caption = "剪刀"
Command3.Caption = "布"
End Sub
'-1石头
'0剪刀
'1布
Private Sub Command1_Click()
Dim a, b As Integer
Randomize
a = -1
b = Int(Rnd * (-3) + 2)
Label1.Caption = "石头"
Select Case a - b
Case -2: Label2.Caption = "布": MsgBox "电脑胜"
Case 0: Label2.Caption = "石头": MsgBox "平"
Case -1: Label2.Caption = "剪刀": MsgBox "玩家胜"
End Select
End Sub
Private Sub Command2_Click()
Dim a, b As Integer
Randomize
a = 0
b = Int(Rnd * (-3) + 2)
Label1.Caption = "剪刀"
Select Case a - b
Case 1: Label2.Caption = "布": MsgBox "玩家胜"
Case 0: Label2.Caption = "剪刀": MsgBox "平"
Case -1: Label2.Caption = "石头": MsgBox "电脑胜"
End Select
End Sub
Private Sub Command3_Click()
Dim a, b As Integer
Randomize
a = 1
b = Int(Rnd * (-3) + 2)
Label1.Caption = "布"
Select Case a - b
Case 2: Label2.Caption = "石头": MsgBox "玩家胜"
Case 0: Label2.Caption = "布": MsgBox "平"
Case 1: Label2.Caption = "剪刀": MsgBox "电脑胜"
End Select
End Sub
Private Sub Form_Load()
Command1.Caption = "石头"
Command2.Caption = "剪刀"
Command3.Caption = "布"
End Sub
2013-05-26
展开全部
显示图片就用image或者picture来显示图片在你出的手势那里加多行loadpicture还有就是电脑出手势那加多个loadpicture就可以了。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询