用VB6.0制作打冰雹游戏

来源:百度知道 编辑:UC知道 时间:2024/09/28 13:28:43
该程序用到控件数组/TIMER定时器控件/颜色/随机值的生成。
(1)游戏启动自动进入游戏状态10个不同颜色的圆球从窗口顶部向下运动。用鼠标指向一个球然后单击。击中加1分,没有减1分。被击中的球立即消失,新的球从顶部落下。
(2)要求同时显示10个球,每个球颜色和速度各不同。单击鼠标时显示一直线表示子弹轨迹。
(3)游戏分4个等级“简单”“中等”“较难”“高级”。默认为“中等”。不同等级下落的总体速度不同。游戏是可以随时选择游戏难度
(4)开始时提供“能量”5。一个球落地减1。当能量为0时显示“你失败了,别灰心,降低难度,请重来!”消息框然后游戏自动改为难度简单,能力恢复为5得分为0。球落地后立即消失,新球从顶部落下。
(5)游戏是达到25分显示“好样的,继续努力!”消息框。达到50分是显示“太棒了,再射中50个你就过关了,努力啊!”消息框。达到100分时显示“恭喜你过关了,增加难度,再继续!”。100分是自动将难度设为“较难”。150分时自动设为“高级”。

麻烦高手赐教,紧急呀~

'新建窗体,添加picture1,timer1,label1,option1(0-3)
’以下保存在模块module1.bas中:
Public Type stdball
ox As Integer
oy As Integer
ballcolor As ColorConstants
speed As Integer
End Type

Public Type stdspark
posx As Integer
posy As Integer
angle As Integer
sparkcolor As ColorConstants
speed As Integer
size As Integer
End Type

Public Type stdsparks
ox As Integer
oy As Integer
spark(9) As stdspark
End Type
'以下保存在窗体代码中:
Dim ball(9) As stdball, sparks(9) As stdsparks, x0 As Single, y0 As Single
Const pi = 3.14159265
Private Sub Form_Load()
initialgame 2, 1
End Sub
Private Sub picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
For i = 0 To 9
If (x - ball(i).ox) ^ 2 + (y - ball(i).oy) ^ 2 < 400 Then
initialspark i
initialball i
Label1.Tag = Split(L