Vb 制作小游戏 一、射击游戏 Option Explicit Dim RandX As Single Dim RandY As Single Dim Score As Single Dim Thisscore As Single Dim Average As Single Dim Shot As Integer Dim Appear As Boolean Dim Distance As Single Private Sub Command1_Click() Timer1.Enabled = True Command3.Enabled = True If Command1.Enabled = True Then Command3.Caption = "暂停" End If Command4.Enabled = True End Sub Private Sub Command2_Click() If Command4.Enabled = True Then MsgBox "请先结束游戏", 48, "警告" Else End End If End Sub Private Sub Command3_Click() Command1.Enabled = False Command3.Caption = "继续" Timer1.Enabled = Not Timer1.Enabled If Timer1.Enabled = True Then Command3.Caption = " 暂停" End If End Sub Private Sub Command4_Click() Timer1.Enabled = False Command3.Enabled = False Command1.Enabled = True Picture1.Cls Label1.Caption = " 射击:" Label2.Caption = " 平均得分:" Label3.Caption = " 环数:" Label4.Caption = " 总分:" Command4.Enabled = False Command3.Caption = "暂停" End Sub Private Sub Form_Load() Appear = False Timer1.Enabled = False Thisscore = 0 Score = 0 Shot = 0 End Sub Private Sub Picture1_MouseDow n(Button As Integer, Shift As Integer, X As Single, Y As Single) Beep Shot = Shot + 1 Picture1.Draw Width = 4 Picture1.PSet (X, Y), RGB(255, 0, 0) Distance = Sqr((X - RandX) * (X - RandX) + (Y - RandY) * (Y - RandY)) If Appear And Timer1.Enabled Then Thisscore = 5 - Int(Distance / 10) If Thisscore <= 0 Then Thisscore = 0 End If Score = Score + Thisscore Average = Int((Score / Shot) * 100) / 100 Label1.Caption = "射击:" + Str(Shot) + "发" Label2.Caption = " 平均得分:" & Format(Average, "0.00") & " 环" Label3.Caption = "环数:" + Str(Thisscore) + "环" Label4.Caption = " 总分:" + Str(Score) + " 环" E...