《VB坦克大战代码.doc》由会员分享,可在线阅读,更多相关《VB坦克大战代码.doc(5页珍藏版)》请在三一办公上搜索。
1、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 Lc.Height = 200 Lc.Width = 200 End SubPrivate Sub Form_keypress(keyascii As Integer) If keyascii = 106 ThenLa.Enabled = FalseLb
2、.Enabled = FalseIf La.Top - Lb.Top = 900 And Lb.Left - La.Left = 300 Then 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 Lc.Top =
3、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 Lc.Top = La.Top + 1600 Lc.Left = La.Left + 300 Lc.Visible = True Timer1.Enabled = False Time
4、r2.Enabled = False Timer3.Enabled = True Timer4.Enabled = False ElseIf Lb.Left - La.Left = 900 And Lb.Top - La.Top = 300 Then 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 IfElseIf keyas
5、cii = 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 If Lb.Top = 0 Then Lb.Enabled = False La.Enabled = False Else La.Top = La.Top - 100 Lb.Top = Lb.Top - 100 End IfElseIf keyascii = 97 Then La.
6、Enabled = True Lb.Enabled = True 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 = 8700 Then Lb.Enabled = False La.Enabled = False Else La.Left = La.Left + 100 Lb.Left = Lb.Left + 100 End If ElseIf keyascii = 115 Then La.Enabled
7、= 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 If Lb.Top = 7600 Then Lb.Enabled = False La.Enabled = False Else La.Top = La.Top + 100 Lb.Top = Lb.Top + 100 End IfElseIf keyascii = 8 Then EndEnd IfEnd SubPrivate Sub
8、 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.Top And Lc.Top 0 Lc.Left = Lc.Left - 2 Lc.Top = Lc.Top If Lc.Left Ld.Left And Lc.Left Ld.Top And Lc.Top Ld.Top + Ld.Height Then Ld.Visible = False Lc.Visible = False End If Loop Lc.Visible = Fal
9、se Timer2.Enabled = FalseEnd SubPrivate Sub Timer3_Timer() Do While Lc.Top Ld.Left And Lc.Left Ld.Top And Lc.Top Ld.Top + Ld.Height Then Ld.Visible = False Lc.Visible = False End If Loop Lc.Visible = False Timer3.Enabled = FalseEnd SubPrivate Sub Timer4_Timer()Do While Lc.Left Ld.Left And Lc.Left Ld.Top And Lc.Top Ld.Top + Ld.Height Then Ld.Visible = False Lc.Visible = False End If Loop Lc.Visible = False Timer4.Enabled = FalseEnd Sub