Image4,Image5,Image6 分别是老鼠的状态(躲下,出来,晕)
Dim 鼠X As Single
Dim 鼠Y As Single
Dim 地鼠 As Byte
Dim 对数 As Integer
Dim 总数 As Integer
Sub 判断(X, Y)
Select Case 地鼠
Case 0, 1, 2
X = 地鼠
Y = 0
Case 3, 4, 5
X = 地鼠 - 3
Y = 1
Case 6, 7, 8
X = 地鼠 - 6
Y = 2
End Select
End Sub
Private Sub Form_Load()
Randomize
Show
For 地鼠 = 0 To 8
判断 X, Y
Form1.PaintPicture Image5.Picture, 1000 + 1050 * X, 1000 + 1050 * Y
Next
总数 = 1
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Move X - Image1.Width / 2, Y - Image1.Height / 2
鼠X = Image1.Left
鼠Y = Image1.Top
Timer1.Enabled = True
Label2.Caption = "运行中..."
End Sub
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = Image3.Picture
xy = 99
If 鼠X >800 And 鼠X <1850 Then
If 鼠Y + 1500 >1600 And 鼠雹凳档Y + 1500 <2350 Then xy = 0
If 鼠Y + 1500 >2650 And 鼠Y + 1500 <3400 Then xy = 3
If 鼠Y + 1500 >3700 And 鼠Y + 1500 <4450 Then xy = 6
End If
If 鼠X >源乱 1850 And 鼠X <2900 Then
If 鼠Y + 1500 >1600 And 鼠Y + 1500 <粗扰 2350 Then xy = 1
If 鼠Y + 1500 >2650 And 鼠Y + 1500 <3400 Then xy = 4
If 鼠Y + 1500 >3700 And 鼠Y + 1500 <4450 Then xy = 7
End If
If 鼠X >2900 And 鼠X <3950 Then
If 鼠Y + 1500 >1600 And 鼠Y + 1500 <2350 Then xy = 2
If 鼠Y + 1500 >2650 And 鼠Y + 1500 <3400 Then xy = 5
If 鼠Y + 1500 >3700 And 鼠Y + 1500 <4450 Then xy = 8
End If
If 地鼠 = xy Then
对数 = 对数 + 1
Label1.Caption = "打中次数 :" &对数
判断 X, Y
Form1.PaintPicture Image6.Picture, 1000 + 1050 * X, 1000 + 1050 * Y
End If
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Move 鼠X - (Image1.Width / 2 - X), 鼠Y - (Image1.Height / 2 - Y)
鼠X = Image1.Left
鼠Y = Image1.Top
End Sub
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = Image2.Picture
End Sub
Private Sub Timer1_Timer()
总数 = 总数 + 1
判断 X, Y
Form1.PaintPicture Image5.Picture, 1000 + 1050 * X, 1000 + 1050 * Y
地鼠 = Int(Rnd * 9)
判断 X, Y
Form1.PaintPicture Image4.Picture, 1000 + 1050 * X, 1000 + 1050 * Y
If 总数 >100 Then
Timer1.Enabled = False
判断 X, Y
Form1.PaintPicture Image5.Picture, 1000 + 1050 * X, 1000 + 1050 * Y
If 对数 >100 Then
msg = MsgBox("恭喜" + Chr(13) + "你以经爆机了,还要继续吗?", vbYesNo, "地鼠娱乐部")
Else
msg = MsgBox("你以经过关了,您打中了" &对数 &"次。还要继续吗?", vbYesNo, "地鼠娱乐部")
End If
If msg = vbYes Then
总数 = 1
对数 = 0
Timer1.Enabled = True
Else
Unload Me
End If
End If
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)