vb打字练习应用程序 20
1.问题描述:设计一个程序,在屏幕上随机出现一些字母并直线下落,然后操作者通过键盘按相应出现的字母,如果按对相应出现的字母,则对应字母消失(如有动画和声音更好),并得分一...
1.问题描述:设计一个程序,在屏幕上随机出现一些字母并直线下落,然后操作者通过键盘按相应出现的字母,如果按对相应出现的字母,则对应字母消失(如有动画和声音更好),并得分一定数量如5分,如不对则字母下落,并到一水平线上消失,不得分。
2.基本要求 :
1)可随机产生大、小写字母;
2)可选择练习(字母下落)的速度;
3)可选择练习的时间;
4)可以进行得分统计;
5)当前玩者最高分。
另,514860049@qq.com 展开
2.基本要求 :
1)可随机产生大、小写字母;
2)可选择练习(字母下落)的速度;
3)可选择练习的时间;
4)可以进行得分统计;
5)当前玩者最高分。
另,514860049@qq.com 展开
展开全部
'要有两个标签一个按钮和两个时间控件
Dim s As Integer
Private Sub Command1_Click()
If Command1.Caption = "开始" Then
s = 0
Command1.Enabled = False
Timer1.Interval = 60000
Timer2.Interval = 10
Label1.Caption = "分数" & s
Timer1.Enabled = True
Timer2.Enabled = True
Label2.Caption = Chr(Int(Rnd() * 26) + 65)
Label2.Top = 0
Label2.Left = Int(Rnd() * (Me.Width - Label2.Width))
End If
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If Chr(KeyCode) = Label2.Caption Then
Label2.Caption = Chr(Int(Rnd() * 26) + 65)
Label2.Top = 0
Label2.Left = Int(Rnd() * (Me.Width - Label2.Width))
s = s + 10
Label1.Caption = "分数" & s
End If
End Sub
Private Sub Form_Load()
Command1.Caption = "开始"
Label1.Caption = ""
Label2.Caption = ""
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = 0
Timer2.Interval = 0
Timer1.Enabled = False
Timer2.Enabled = False
Command1.Enabled = True
Label1.Caption = "游戏结束!总分:" & s
End Sub
Private Sub Timer2_Timer()
Label2.Top = Label2.Top + 40
If Label2.Top > Me.Height Then
Label2.Caption = Chr(Int(Rnd() * 26) + 65)
Label2.Top = 0
Label2.Left = Int(Rnd() * (Me.Width - Label2.Width))
End If
End Sub
Dim s As Integer
Private Sub Command1_Click()
If Command1.Caption = "开始" Then
s = 0
Command1.Enabled = False
Timer1.Interval = 60000
Timer2.Interval = 10
Label1.Caption = "分数" & s
Timer1.Enabled = True
Timer2.Enabled = True
Label2.Caption = Chr(Int(Rnd() * 26) + 65)
Label2.Top = 0
Label2.Left = Int(Rnd() * (Me.Width - Label2.Width))
End If
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If Chr(KeyCode) = Label2.Caption Then
Label2.Caption = Chr(Int(Rnd() * 26) + 65)
Label2.Top = 0
Label2.Left = Int(Rnd() * (Me.Width - Label2.Width))
s = s + 10
Label1.Caption = "分数" & s
End If
End Sub
Private Sub Form_Load()
Command1.Caption = "开始"
Label1.Caption = ""
Label2.Caption = ""
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = 0
Timer2.Interval = 0
Timer1.Enabled = False
Timer2.Enabled = False
Command1.Enabled = True
Label1.Caption = "游戏结束!总分:" & s
End Sub
Private Sub Timer2_Timer()
Label2.Top = Label2.Top + 40
If Label2.Top > Me.Height Then
Label2.Caption = Chr(Int(Rnd() * 26) + 65)
Label2.Top = 0
Label2.Left = Int(Rnd() * (Me.Width - Label2.Width))
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询