VB坦克大战代码
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
If Lb.Top <= 0 Then
Lb.Enabled = False
La.Enabled = False
Else
La.Top = La.Top - 100
Lb.Top = Lb.Top - 100
End If
ElseIf keyascii = 97 Then
La.Enabled = True
Lb.Enabled = True
Lc.Top = La.Top - 900
Lc.Left = La.Left + 300
Lc.Visible = True
Timer1.Enabled = True
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
ElseIf La.Left - Lb.Left = 900 And Lb.Top - La.Top = 300 Then
Lb.Left = La.Left - 900
Lb.Top = La.Top + 300
La.Height = 800
La.Width = 900
Lb.Width = 900
Lb.Height = 200
If Lb.Left <= 0 Then
Lb.Enabled = False
La.Enabled = False
Lc.Top = Lc.Top
If Lc.Left > Ld.Left And Lc.Left < Ld.Left + Ld.Width And Lc.Top > Ld.Top And Lc.Top < Ld.Top + Ld.Height Then
Ld.Visible = False
Lc.Visible = False
La.Height = 800
La.Width = 900
Lb.Width = 900
Lb.Height = 200
If Lb.Left >= 8700 Then
Lb.Enabled = False
La.Enabled = False
Else
La.Left = La.Left + 100
Lb.Left = Lb.Left + 100
Lc.Top = La.Top + 300
Lc.Left = La.Left - 900
Lc.Visible = True
Timer1.Enabled = False
Timer2.Enabled = True
Timer3.Enabled = False
Timer4.Enabled = False
ElseIf Lb.Top - La.Top = 900 And Lb.Left - La.Left = 300 Then
Lb.Height = 900
If Lb.Top >= 7600 Then
Lb.Enabled = False
La.Enabled = False
E百度文库se
La.Top = La.Top + 100
Lb.Top = Lb.Top + 100
End If
ElseIf keyascii = 8 Then
End
Ld.Visible = False
Lc.Visible = False
End If
Loop
Lc.Visible = False
Timer3.Enabled = False
End Sub
Private Sub Timer4_Timer()
Do While Lc.Left < 9750
Lc.Left = Lc.Left + 2
Ld.Visible = False
Lc.Visible = False
End If
Loop
Lc.Visible = False
Timer1.Enabled = False
End Sub
Private Sub Timer2_Timer()
Do While Lc.Left > 0
Lc.Left = Lc.Left - 2
Lc.Height = 200
Lc.Width = 200
End Sub
Private Sub Form_keypress(keyascii As Integer)
If keyascii = 106 Then
La.Enabled = False
Lb.Enabled = False
If La.Top - Lb.Top = 900 And Lb.Left - La.Left = 300 Then
Else
La.Left = La.Left - 100
Lb.Left = Lb.Left - 100
End If
ElseIf keyascii = 100 Then
La.Enabled = True
Lb.Enabled = True
Lb.Left = La.Left + 900
Lb.Top = La.Top + 300
End If
ElseIf keyascii = 115 Then
La.Enabled = True
Lb.Enabled = True
Lb.Left = La.Left + 300
Lb.Top = La.Top + 900
La.Height = 900
La.Width = 800
Lb.Width = 200
Lc.Top = La.Top + 300
Lc.Left = La.Left + 1600
Lc.Visible = True
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = True
End If
End If
End Sub
Private Sub Timer1_Timer()
Do While Lc.Top > 0
Lc.Top = Lc.Top - 2
Lc.Left = Lc.Left
If Lc.Left > Ld.Left And Lc.Left < Ld.Left + Ld.Width And Lc.Top > Ld.Top And Lc.Top < Ld.Top + Ld.Height Then
End If
Loop
Lc.Visible = False
Timer2.Enabled = False
End Sub
Private Sub Timer3_Timer()
Do While Lc.Top < 8880
Lc.Top = Lc.Top + 2
Lc.Left = Lc.Left
If Lc.Left > Ld.Left And Lc.Left < Ld.Left + Ld.Width And Lc.Top > Ld.Top And Lc.Top < Ld.Top + Ld.Height Then
ElseIf keyascii = 119 Then
La.Enabled = True
Lb.Enabled = True
Lb.Left = La.Left + 300
Lb.Top = La.Top - 900
La.Height = 900
La.Width = 800
Lb.Width = 200
Lb.Height = 900
Lc.Top = Lc.Top
If Lc.Left > Ld.Left And Lc.Left < Ld.Left + Ld.Width And Lc.Top > Ld.Top And Lc.Top < Ld.Top + Ld.Height Then
Ld.Visible = False
Lc.Visible = False
End If
Loop
Lc.Visible = False
Timer4.Enabled = False
End Sub
Lc.Top = La.Top + 1600
Lc.Left = La.Left + 300
Lc.Visible = True
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = True
Timer4.Enabled = False
ElseIf Lb.Left - La.Left = 900 And Lb.Top - La.Top = 300 Then
Private Sub Form_Load()
La.Top = 4000
La.Left = 3000
La.Height = 800
La.Width = 900
Lb.Top = 4300
Lb.Left = 3900
Lb.Height = 200
Lb.Width = 900
Lc.Top = 4300
Lc.Left = 4560
Lb.Enabled = False
La.Enabled = False
Else
La.Top = La.Top - 100
Lb.Top = Lb.Top - 100
End If
ElseIf keyascii = 97 Then
La.Enabled = True
Lb.Enabled = True
Lc.Top = La.Top - 900
Lc.Left = La.Left + 300
Lc.Visible = True
Timer1.Enabled = True
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
ElseIf La.Left - Lb.Left = 900 And Lb.Top - La.Top = 300 Then
Lb.Left = La.Left - 900
Lb.Top = La.Top + 300
La.Height = 800
La.Width = 900
Lb.Width = 900
Lb.Height = 200
If Lb.Left <= 0 Then
Lb.Enabled = False
La.Enabled = False
Lc.Top = Lc.Top
If Lc.Left > Ld.Left And Lc.Left < Ld.Left + Ld.Width And Lc.Top > Ld.Top And Lc.Top < Ld.Top + Ld.Height Then
Ld.Visible = False
Lc.Visible = False
La.Height = 800
La.Width = 900
Lb.Width = 900
Lb.Height = 200
If Lb.Left >= 8700 Then
Lb.Enabled = False
La.Enabled = False
Else
La.Left = La.Left + 100
Lb.Left = Lb.Left + 100
Lc.Top = La.Top + 300
Lc.Left = La.Left - 900
Lc.Visible = True
Timer1.Enabled = False
Timer2.Enabled = True
Timer3.Enabled = False
Timer4.Enabled = False
ElseIf Lb.Top - La.Top = 900 And Lb.Left - La.Left = 300 Then
Lb.Height = 900
If Lb.Top >= 7600 Then
Lb.Enabled = False
La.Enabled = False
E百度文库se
La.Top = La.Top + 100
Lb.Top = Lb.Top + 100
End If
ElseIf keyascii = 8 Then
End
Ld.Visible = False
Lc.Visible = False
End If
Loop
Lc.Visible = False
Timer3.Enabled = False
End Sub
Private Sub Timer4_Timer()
Do While Lc.Left < 9750
Lc.Left = Lc.Left + 2
Ld.Visible = False
Lc.Visible = False
End If
Loop
Lc.Visible = False
Timer1.Enabled = False
End Sub
Private Sub Timer2_Timer()
Do While Lc.Left > 0
Lc.Left = Lc.Left - 2
Lc.Height = 200
Lc.Width = 200
End Sub
Private Sub Form_keypress(keyascii As Integer)
If keyascii = 106 Then
La.Enabled = False
Lb.Enabled = False
If La.Top - Lb.Top = 900 And Lb.Left - La.Left = 300 Then
Else
La.Left = La.Left - 100
Lb.Left = Lb.Left - 100
End If
ElseIf keyascii = 100 Then
La.Enabled = True
Lb.Enabled = True
Lb.Left = La.Left + 900
Lb.Top = La.Top + 300
End If
ElseIf keyascii = 115 Then
La.Enabled = True
Lb.Enabled = True
Lb.Left = La.Left + 300
Lb.Top = La.Top + 900
La.Height = 900
La.Width = 800
Lb.Width = 200
Lc.Top = La.Top + 300
Lc.Left = La.Left + 1600
Lc.Visible = True
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = True
End If
End If
End Sub
Private Sub Timer1_Timer()
Do While Lc.Top > 0
Lc.Top = Lc.Top - 2
Lc.Left = Lc.Left
If Lc.Left > Ld.Left And Lc.Left < Ld.Left + Ld.Width And Lc.Top > Ld.Top And Lc.Top < Ld.Top + Ld.Height Then
End If
Loop
Lc.Visible = False
Timer2.Enabled = False
End Sub
Private Sub Timer3_Timer()
Do While Lc.Top < 8880
Lc.Top = Lc.Top + 2
Lc.Left = Lc.Left
If Lc.Left > Ld.Left And Lc.Left < Ld.Left + Ld.Width And Lc.Top > Ld.Top And Lc.Top < Ld.Top + Ld.Height Then
ElseIf keyascii = 119 Then
La.Enabled = True
Lb.Enabled = True
Lb.Left = La.Left + 300
Lb.Top = La.Top - 900
La.Height = 900
La.Width = 800
Lb.Width = 200
Lb.Height = 900
Lc.Top = Lc.Top
If Lc.Left > Ld.Left And Lc.Left < Ld.Left + Ld.Width And Lc.Top > Ld.Top And Lc.Top < Ld.Top + Ld.Height Then
Ld.Visible = False
Lc.Visible = False
End If
Loop
Lc.Visible = False
Timer4.Enabled = False
End Sub
Lc.Top = La.Top + 1600
Lc.Left = La.Left + 300
Lc.Visible = True
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = True
Timer4.Enabled = False
ElseIf Lb.Left - La.Left = 900 And Lb.Top - La.Top = 300 Then
Private Sub Form_Load()
La.Top = 4000
La.Left = 3000
La.Height = 800
La.Width = 900
Lb.Top = 4300
Lb.Left = 3900
Lb.Height = 200
Lb.Width = 900
Lc.Top = 4300
Lc.Left = 4560