温州悟道创意文化传媒:我因期末考试有一个小程序要调试,望高手来帮忙,谢谢

来源:百度文库 编辑:高校问答 时间:2024/05/10 07:58:54
我因期末考试有一个小程序要调试,望高手来帮忙
程序是一个vb的小游戏,现在还没编译,有多中个文件,让我打包后压成1个文件,地址是
http://willkc.go1.icpcn.com/will.zip
谢谢,考试需要

楼主,对你的程序已进行了修改,但还存在一些错误,如果还有问题要问,我的QQ是110807087

Option Explicit
Dim a As String
Dim n As Integer
Dim j As Integer
Dim d
Dim ii As Integer
Dim score As Integer

Private Sub Command1_Click()
Picture1.SetFocus
Label1(0) = ""
Label3 = ""
Command2.Enabled = True
Timer1.Enabled = True
Timer2.Enabled = True
Picture1.SetFocus
Label6.Caption = "你选择了第" & VScroll1.Value & "关"
n = 0
Label3.Caption = n
End Sub

Private Sub Command2_Click()
If Timer1.Enabled = True Then
Timer1.Enabled = False
If Timer2.Enabled = True Then
Timer1.Enabled = False
Command2.Caption = "继续"
Else
Timer2.Enabled = True
Command2.Caption = "暂停"
End If
Picture1.SetFocus
Else
Timer1.Enabled = True
End If
End Sub

Private Sub Command3_Click()
End
End Sub

Private Sub Form_Load()
On Error Resume Next
Dim i As Integer
Dim E As Integer
Picture1.Height = 6500
Picture1.Width = 11500
WindowState = 2
score = 0
For i = 1 To 10
Load Label1(i)
Label1(i).Top = -700
Label1(i).Visible = True
Next i

Randomize
n = 0
'ProgressBar1.Value = 20
Command2.Enabled = False

E = VScroll1.Value
Label4.Caption = " 目前你在第" & E & "关" & vbCrLf _
& vbCrLf & _
" 每得分50加一关,得-20分游戏结束!"

Timer1.Enabled = False
Timer2.Enabled = False
Label5.Caption = 60
Timer1.Interval = 100

For i = 1 To 10
a = Chr$(Int(Rnd * 26 + 97))
Label1(i).Caption = a
Next i

d = 50

For i = 1 To 10
Label1(i).Left = 600 * i
Label1(i).Font.Size = 36
Label1(i).ForeColor = Int(Rnd * vbRed + Rnd * vbGreen + Rnd * vbBlue)
Next i

' Randomize

End Sub

Private Sub Picture1_KeyPress(KeyAscii As Integer)
Dim i As Integer
Static b
For ii = 1 To 10
If KeyAscii = Asc(Label1(ii).Caption) Then
Call CS
End If
Next ii
' n = n + 1
' Label3.Caption = n
' 'ProgressBar1.Value = ProgressBar1.Value + 4
' Else
' n = n - 1
' Label3.Caption = n
' 'ProgressBar1.Value = ProgressBar1.Value - 4
' Call CS
'End If
End Sub

Private Sub Timer1_Timer()
Dim i As Integer
Dim b As Integer
Static C
d = VScroll1.Value
Static E
Randomize
For i = 1 To 10
Label1(i).Top = Label1(i).Top + d * 30

'
If Label1(i).Top > Picture1.Height Then
n = n + 1
' Label3.Caption = n
' ProgressBar1.Value = ProgressBar1.Value - 4
If n <= -20 Then
' ' If ProgressBar1.Value <= 0 Then
b = MsgBox("你已经失败了,不要紧,下次再来!是否重新开始游戏", _
vbYesNo + vbQuestion, "要加倍努力")
If b = 6 Then Form_Load
If b = 7 Then End
End If
Label1(i).Top = -150
a = Chr$(Int(Rnd * 26 + 97))
Label1(i).Caption = a
End If
If score >= 50 Then
' If ProgressBar1.Value >= 50 Then
b = MsgBox("恭喜你过关了,是否进入下一关?", vbYesNo, "打字练习")

If b = 6 Then
VScroll1.Value = VScroll1.Value + 1
Command1.SetFocus
Form_Load
End If
If b = 7 Then End
End If

If n <= -20 Then
' If ProgressBar1.Value <= 0 Then
b = MsgBox("你已经失败了,不要紧,下次再来!是否重新开始游戏", _
vbYesNo + vbQuestion, "要加倍努力")
If b = 6 Then Form_Load
Command1.SetFocus
If b = 7 Then End
End If
Next i
End Sub

Public Sub CS()
Dim f As Integer
Label1(ii).Top = -50
Randomize
a = Chr$(Int(Rnd * 26 + 97))
Label1(ii).Caption = a
f = Int(Rnd * 11100 + 100)
Label1(ii).Left = f
Label1(ii).ForeColor = Int(Rnd * vbRed + Rnd * vbGreen + Rnd * vbBlue)
score = score + 1
Label3.Caption = Str(score)
End Sub

Private Sub Timer2_Timer()
Dim i As Integer
'Timer2.Enabled = True
Label5.Caption = Val(Label5.Caption) - 1
If Val(Label5.Caption) <= 0 Then
Timer1.Enabled = False
For j = 1 To 10
Label1(j).Caption = ""
Next j
i = MsgBox("您的时间已经到了,不要紧,下次再来!是否重新开始游戏", _
vbYesNo + vbQuestion, "要加倍努力")
'If i = 1 Then
' Command1_Click
' Timer2.Enabled = False
'Else
' Timer2.Enabled = False
'End If
End If
End Sub

Private Sub VScroll1_Change()
Dim E As Integer
Command1.Enabled = True
Label6.Caption = "你选择了第" & VScroll1.Value & "关"
E = VScroll1.Value
Label4.Caption = " 目前你在第" & E & "关" & vbCrLf _
& vbCrLf & _
" 每答对50个加一关,答错25个游戏结束!"
End Sub

参考俄罗斯方块和贪吃蛇
网上到处有源码,我就不特地为你找了.

你希望怎么样?是修改当中的错误还是什么意思?