【VB开源代码栏目提醒】:网学会员在VB开源代码频道为大家收集整理了“打地鼠VB程序源代码 - 编程语言“提供大家参考,希望对大家有所帮助!
DDS Dim allnum As Integer oknum As Integer 定义变化次数 打中次数 Private Sub a_Click Timer1.Interval 1000 新手 End Sub Private Sub b_Click Timer1.Interval 700 达人 End Sub Private Sub c_Click Timer1.Interval 500 老手 End Sub Private Sub Command1_Click If Command1.Caption 继续 Then Timer1.Enabled True Label2.Caption 运行中... Else Timer1.Enabled True 时间启动 allnum 0 变化次数初始为0 oknum 0 打中次数初始为0 Label2.Caption 运行中... End If Command1.Enabled False Command2.Enabled True End Sub Private Sub Command2_Click Timer1.Enabled False 暂停 Label2.Caption 暂停中... Command1.Caption 继续 Command1.Enabled True Command2.Enabled False End Sub Private Sub Command3_Click Unload Me 结束 End Sub Private Sub Form_Load Timer1.Enabled False 时间不启动 allnum 0 变化次数初始为0 oknum 0 打中次数初始为0 End Sub Private Sub Picture1_ClickIndex As Integer If Picture1Index.Visible True Then Picture1Index.picture Src.Picture1.picture 击晕图显示 oknum oknum 1 打中次数1 End If End Sub Private Sub tc_Click Unload Me 退出 End Sub Private Sub Timer1_Timer Text1.Text oknum / allnum 打印得分 allnum allnum 1 变化次数值1 For i 0 To 23 Picture1i.Visible False 地鼠消失 Next Randomize Picture1IntRnd 23.Visible True 随机函数控制地鼠图片显示 End Sub Private Sub gy_Click MsgBox 打地鼠 Chr13 Chr13 Boy小作品 Chr13 _ QQ591028872 作者寄语 作者寄语 End Sub SJB Private Sub Form_Activate Option1.Caption 石头 Option2.Caption 剪刀 Option3.Caption 布 Option1.Value False Option2.Value False Option3.Value False End Sub Private Sub Option1_Click Randomize Select Case Int3 Rnd Case 0: a MsgBox对方也出石头继续 1 64 快乐游戏 Case 1: a MsgBox哈哈你赢了对方出的是剪刀奖励你一个苹果 1 64 快乐游戏 Case 2: a MsgBox你输了对方出的是布哦不好意思苹果给对方了哈 1 64 快乐游戏 End Select Option1.Value False End Sub Private Sub Option2_Click Randomize Select Case Int3 Rnd Case 0: a MsgBox你输了对方出的是石头哦不好意思苹果给对方了哈 1 64 快乐游戏 Case 1: a MsgBox对方也出剪刀继续 1 64 快乐游戏 Case 2: a MsgBox哈哈你赢了对方出的是布奖励你一个苹果 1 64 快乐游戏 End Select Option2.Value False End Sub Private Sub Option3_Click Randomize Select Case Int3 Rnd Case 0: a MsgBox哈哈你赢了对方出的是石头奖励你一个苹果 1 64 快乐游戏 Case 1: a MsgBox你输了对方出的是剪刀哦不好意思苹果给对方了哈 1 64 快乐游戏 Case 2: a MsgBox对方也出布继续 1 64 快乐游戏 End Select Option3.Value False End Sub SZ Dim lenth As Integer q As Integer Const PI 3.14159 Private Sub Form_Load lenth Line1.Y2 - Line1.Y1 q 90 End Sub Private Sub Timer1_Timer q q - 6 Line1.Y1 Line1.Y2 - lenth Sinq PI / 180 Line1.X1 Line1.X2 lenth Cosq PI / 180 Label1.Caption 当前系统时间 Time Label2.Caption 当前系统日期 Date End Sub TQ Dim x_step As Integer Dim y_step As Integer Dim gametime As Integer Dim gamescore As Integer Dim move_x As Integer Private Sub Command1_Click Picture1.SetFocus If Command1.Caption 开始 Then Timer1.Enabled True Timer2.Enabled True Command1.Caption 暂停 ElseIf Command1.Caption 暂停 Then Timer1.Enabled False Timer2.Enabled False Command1.Caption 继续 ElseIf Command1.Caption 继续 Then Command1.Caption 暂停 Timer1.Enabled True Timer2.Enabled True End If End Sub Private Sub Command2_Click Unload Me End Sub Private Sub Form_Load x_step 250 y_step 250 move_x 0 Command1.Caption 开始 Timer1.Enabled False Timer2.Enabled False gametime 0 gamescore 0 FrmTQ.Left Screen.Width - FrmTQ.Width / 2 FrmTQ.Top Screen.Height - FrmTQ.Height / 2 - 600 End Sub Private Sub Picture1_KeyDownKeyCode As Integer Shift As Integer Select Case KeyCode Case 37 如果按下左箭头使板子向左移动 If Line1.X1 Picture1.Left Picture1.Width Then Shape1.Left Picture1.Left Picture1.Width - Shape1.Width x_step -x_ste