Private Sub Command1_Click()
'曾加速度
Label5.Caption = Label5.Caption + 1
End Sub
'减小速度
Private Sub Command2_Click()
Label5.Caption = Label5.Caption - 1
End Sub
'开始游戏
Private Sub Command3_Click()
If Option1.Value Then
Timer1.Interval = 1
Timer2.Interval = 0
Label7.Caption = ""
Label1.Top = 8760
Label6.Top = 8760
Label1.Visible = True
Label6.Visible = True
End If
If Option2.Value Then
Timer2.Interval = 1
Timer1.Interval = 0
Label1.Caption = ""
Label6.Caption = ""
Randomize
Cls
a = Array("one", "two", "three", "free", "feel", "fly", "lacking", "the", "power", "that")
x = Int(Rnd * (UBound(a) + 1))
Label7.Caption = a(x)
Command1.Enabled = False
Command2.Enabled = False
Label7.Top = 0
Label7.Visible = True
End If
Text1.SetFocus
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
'判断简单时是否打中,并使成绩加一
If Option1.Value Then
Timer1.Interval = 1
If KeyAscii = Asc(Label1.Caption) Then
Label1.Top = 0
Label1.Left = Rnd() * 10800
Label1.Caption = Chr$(Rnd() * 26 + 97)
Label2.Caption = Label2.Caption + 1
End If
If KeyAscii = Asc(Label6.Caption) Then
Label6.Top = 0
Label6.Left = Rnd() * 10800
Label6.Caption = Chr$(Rnd() * 26 + 97)
Label2.Caption = Label2.Caption + 1
End If
End If
'判断困难时是否打中,并使成绩加一
If Option2.Value Then
Timer2.Interval = 1
End If
If KeyAscii >= 65 And KeyAscii <= 86 Or KeyAscii >= 97 And KeyAscii <= 122 Then
Label8.Caption = Label8.Caption & Chr(KeyAscii)
ElseIf KeyAscii = 32 Then
Label8.Caption = ""
Text1.Text = ""
End If
If Label7.Caption = Label8.Caption Then
Label7.Caption = ""
Label8.Caption = ""
Text1.Text = ""
Label7.Top = 0
Label7.Left = Rnd() * 10800
Randomize
Cls
a = Array("one", "two", "three", "free", "feel", "fly", "lacking", "the", "power", "that")
x = Int(Rnd * (UBound(a) + 1))
Label7.Caption = a(x)
Label2.Caption = Label2.Caption + 1
End If
End Sub
'退出
Private Sub Command4_Click()
Timer1.Enabled = False
Timer2.Enabled = False
If MsgBox("你确定要退出吗", vbOKCancel) = vbOK Then
End
Else
Timer1.Enabled = True
Timer2.Enabled = True
End If
End Sub
'暂停或继续游戏
Private Sub Command5_Click()
Static f As Integer
If f = 0 Then
Timer1.Interval = 0
Timer2.Interval = 0
f = 1
Command3.SetFocus
Else
Timer1.Interval = 1
Timer2.Interval = 1
f = 0
Command3.SetFocus
End If
End Sub
'重新游戏
Private Sub Command6_Click()
Timer1.Interval = 0
Label2.Caption = 0
Label5.Caption = 18
Timer1.Interval = 0
Timer2.Interval = 0
Label1.Visible = False
Label6.Visible = False
Label7.Visible = False
Label1.Caption = ""
Label6.Caption = ""
Label7.Caption = ""
Command1.Enabled = True
Command2.Enabled = True
End Sub
Private Sub Timer1_Timer()
Randomize
'简单时游戏速度
Label1.Top = Label1.Top + Label5.Caption
Label6.Top = Label6.Top + Label5.Caption + 15
'判断是否到底,并随机生成字母,从顶开始
If Label1.Top > 8760 Then
Label1.Top = 0
Label1.Left = Rnd() * 10800
Label1.Caption = Chr$(Rnd() * 26 + 96)
End If
If Label6.Top > 8760 Then
Label6.Top = 0
Label6.Left = Rnd() * 10800
Label6.Caption = Chr$(Rnd() * 26 + 96)
End If
End Sub
Private Sub Timer2_Timer()
Randomize
'困难时游戏速度
Label7.Top = Label7.Top + Label5.Caption + 10
'判断是否到底,并随机生成单词,从顶开始
If Label7.Top > 8760 Then
Label7.Top = 0
Label7.Left = Rnd() * 10800
Randomize
Cls
a = Array("one", "two", "three", "free", "feel", "fly", "lacking", "the", "power", "that")
x = Int(Rnd * (UBound(a) + 1))
Label7.Caption = a(x)
Else
Label7.Top = Label7.Top + 5
End If
End Sub
'曾加速度
Label5.Caption = Label5.Caption + 1
End Sub
'减小速度
Private Sub Command2_Click()
Label5.Caption = Label5.Caption - 1
End Sub
'开始游戏
Private Sub Command3_Click()
If Option1.Value Then
Timer1.Interval = 1
Timer2.Interval = 0
Label7.Caption = ""
Label1.Top = 8760
Label6.Top = 8760
Label1.Visible = True
Label6.Visible = True
End If
If Option2.Value Then
Timer2.Interval = 1
Timer1.Interval = 0
Label1.Caption = ""
Label6.Caption = ""
Randomize
Cls
a = Array("one", "two", "three", "free", "feel", "fly", "lacking", "the", "power", "that")
x = Int(Rnd * (UBound(a) + 1))
Label7.Caption = a(x)
Command1.Enabled = False
Command2.Enabled = False
Label7.Top = 0
Label7.Visible = True
End If
Text1.SetFocus
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
'判断简单时是否打中,并使成绩加一
If Option1.Value Then
Timer1.Interval = 1
If KeyAscii = Asc(Label1.Caption) Then
Label1.Top = 0
Label1.Left = Rnd() * 10800
Label1.Caption = Chr$(Rnd() * 26 + 97)
Label2.Caption = Label2.Caption + 1
End If
If KeyAscii = Asc(Label6.Caption) Then
Label6.Top = 0
Label6.Left = Rnd() * 10800
Label6.Caption = Chr$(Rnd() * 26 + 97)
Label2.Caption = Label2.Caption + 1
End If
End If
'判断困难时是否打中,并使成绩加一
If Option2.Value Then
Timer2.Interval = 1
End If
If KeyAscii >= 65 And KeyAscii <= 86 Or KeyAscii >= 97 And KeyAscii <= 122 Then
Label8.Caption = Label8.Caption & Chr(KeyAscii)
ElseIf KeyAscii = 32 Then
Label8.Caption = ""
Text1.Text = ""
End If
If Label7.Caption = Label8.Caption Then
Label7.Caption = ""
Label8.Caption = ""
Text1.Text = ""
Label7.Top = 0
Label7.Left = Rnd() * 10800
Randomize
Cls
a = Array("one", "two", "three", "free", "feel", "fly", "lacking", "the", "power", "that")
x = Int(Rnd * (UBound(a) + 1))
Label7.Caption = a(x)
Label2.Caption = Label2.Caption + 1
End If
End Sub
'退出
Private Sub Command4_Click()
Timer1.Enabled = False
Timer2.Enabled = False
If MsgBox("你确定要退出吗", vbOKCancel) = vbOK Then
End
Else
Timer1.Enabled = True
Timer2.Enabled = True
End If
End Sub
'暂停或继续游戏
Private Sub Command5_Click()
Static f As Integer
If f = 0 Then
Timer1.Interval = 0
Timer2.Interval = 0
f = 1
Command3.SetFocus
Else
Timer1.Interval = 1
Timer2.Interval = 1
f = 0
Command3.SetFocus
End If
End Sub
'重新游戏
Private Sub Command6_Click()
Timer1.Interval = 0
Label2.Caption = 0
Label5.Caption = 18
Timer1.Interval = 0
Timer2.Interval = 0
Label1.Visible = False
Label6.Visible = False
Label7.Visible = False
Label1.Caption = ""
Label6.Caption = ""
Label7.Caption = ""
Command1.Enabled = True
Command2.Enabled = True
End Sub
Private Sub Timer1_Timer()
Randomize
'简单时游戏速度
Label1.Top = Label1.Top + Label5.Caption
Label6.Top = Label6.Top + Label5.Caption + 15
'判断是否到底,并随机生成字母,从顶开始
If Label1.Top > 8760 Then
Label1.Top = 0
Label1.Left = Rnd() * 10800
Label1.Caption = Chr$(Rnd() * 26 + 96)
End If
If Label6.Top > 8760 Then
Label6.Top = 0
Label6.Left = Rnd() * 10800
Label6.Caption = Chr$(Rnd() * 26 + 96)
End If
End Sub
Private Sub Timer2_Timer()
Randomize
'困难时游戏速度
Label7.Top = Label7.Top + Label5.Caption + 10
'判断是否到底,并随机生成单词,从顶开始
If Label7.Top > 8760 Then
Label7.Top = 0
Label7.Left = Rnd() * 10800
Randomize
Cls
a = Array("one", "two", "three", "free", "feel", "fly", "lacking", "the", "power", "that")
x = Int(Rnd * (UBound(a) + 1))
Label7.Caption = a(x)
Else
Label7.Top = Label7.Top + 5
End If
End Sub