vb小球碰壁游戏加强版思路,向大大们请教下.
来源:百度知道 编辑:UC知道 时间:2024/05/15 09:56:58
请各位大大给我点意见.指点指点.主要我想先实现上面第一个功能.没什么难度.不过我才学VB不就,什么都不懂,大大们指点指点啊!!给小弟个思路.有源码就最好不过了.谢谢!!
5555555555~ 实在不知道怎么做啊..T_T 我用了个SHAPE做..实在不知道怎样撞到它后反弹!!. 请大大们帮下我啊..给出源码!!. 谢谢!!满意的话再加50!
设置窗体名称frmZQ,StartUpPosition=屏幕中心,ScaleMode=3
添加两个Shape1,Shape2
一个时钟控件Timer1
代码如下:
Dim D As Integer '发球方向
Dim F As Boolean '发球信号
Dim V As Integer '移动距离
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 32
Timer1.Enabled = True
F = True
Case 37
Shape1.Left = Shape1.Left - V
If Shape1.Left <= 0 Then Shape1.Left = 0
If F = False Then Shape2.Left = Shape1.Left + (Shape1.Width - Shape2.Width) / 2: D = 2
Case 39
Shape1.Left = Shape1.Left + V
If Shape1.Left >= frmZQ.ScaleWidth - Shape1.Width Then Shape1.Left = frmZQ.ScaleWidth - Shape1.Width
If F = False Then Shape2.Left = Shape1.Left + (Shape1.Width - Shape2.Width) / 2: D = 4
Case Else
End Select
End Sub
Private Sub Form_Load()
With Shape1
.Left = (frmZQ.ScaleWidth - .Width) / 2
.Top = 260
En