【#第一文档网# 导语】以下是®第一文档网的小编为您整理的《vb简单打地鼠游戏代码》,欢迎阅读!
简单《打地鼠》游戏代码 设计方案: 1. 图相框组picture1(0)~picture1(8)用来显示随机出现的地鼠。 2. image1和image2分别显示打中前后的地鼠图片。 3. picture2用来装picture1(只是为了美观)。 4. text1用来显示打中地鼠的个数。 5. 地鼠出现的时间间隔设置为500毫秒。 Option Explicit Dim i As Long Dim n As Long Private Sub Form_Load() Timer1.Interval = 500 End Sub Private Sub Picture1_Click(Index As Integer) Picture1(i).Picture = Image2.Picture If 2 > 1 Then ‘制造一个循环,使打中次数累加,n不设初值。’ n = n + 1 Text1 = "打中" & n & "次" End If End Sub Private Sub Timer1_Timer() For i = 0 To 8 Picture1(i).Picture = LoadPicture() Next Randomize i = Rnd() * 8 Picture1(i).Picture = Image1.Picture End Sub 本文来源:https://www.dywdw.cn/df480b490812a21614791711cc7931b765ce7bf2.html