求做一个简单vb的打地鼠游戏。 明天要交好久没搞好

求做一个简单vb的打地鼠游戏。明天要交好久没搞好
2024-12-03 00:39:55
推荐回答(2个)
回答(1):

昨天也有个人问 你们不会是同学吧

回答(2):

1、控件:
Picture1(0~8) 排三列三排
Timer1 Interval设为1000
Text1 Text 设为0
Command1 caption 设为“开始”
2、代码:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim m, i, n As Integer
Private Sub Form_Load()
Timer1.Enabled = False
For l = 0 To 8
Picture1(l).Visible = False
Next l
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
If i < 9 Then
Picture1(i).Visible = False
End If
Randomize
i = (Rnd() * 8) Mod 10
Picture1(i).Visible = True
Picture1(i).ZOrder
If n = 10 Then
Picture1(i).Visible = False
If Text1 >= 80 Then
m = m + 1
c = MsgBox("恭喜你过关了。你的得分为" & Text1 & vbCrLf & "是否进入" & m + 1 & "关", 4)
If c = vbYes Then
Timer1.Interval = Timer1.Interval - 100 * (11 - m) / 10
Else
Timer1.Enabled = False
End If
Else
MsgBox "请重新开始!"
End If
n = 0
Text1 = 0
End If
n = n + 1
End Sub
Private Sub Picture1_Click(Index As Integer)
Select Case Index
Case Index
If Index = i Then
Timer1.Enabled = False
Text1 = Text1 + 10
MsgBox "恭喜你!"
Timer1.Enabled = True
End If
End Select
End Sub