Advertisement
Guest User

SAAD

a guest
Jan 28th, 2015
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. Public Class Form1
  2. Shared random As New Random()
  3. Dim missiles(19) As PictureBox
  4. Dim X1, Y1 As Integer
  5. Dim score As Integer = 0
  6.  
  7. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  8. scoreofftxt.Text = score
  9. Dim nl As PictureBox
  10. For x = 0 To 9
  11. For y = 0 To 1
  12.  
  13. Dim i As Integer
  14. For i = 0 To 5
  15. X1 = random.Next(10, 810)
  16. Next
  17. Dim ib As Integer
  18. For ib = 0 To 5
  19. Y1 = random.Next(-800, 0)
  20. Next
  21.  
  22. nl = New PictureBox
  23. nl.Width = 25
  24. nl.Height = 45
  25.  
  26. nl.Left = X1
  27. nl.Top = Y1
  28.  
  29. Controls.Add(nl)
  30. nl.Image = example.Image
  31. nl.BackgroundImage = My.Resources.BGTK
  32.  
  33. nl.SizeMode = PictureBoxSizeMode.StretchImage
  34. missiles(y * 10 + x) = nl
  35. nl.BringToFront()
  36. Next
  37. Next
  38. End Sub
  39.  
  40. Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
  41. Select Case e.KeyCode
  42. Case Keys.A
  43. a.Enabled = True
  44. d.stop()
  45. Case Keys.D
  46. a.Stop()
  47. d.enabled = True
  48. End Select
  49. End Sub
  50.  
  51. Private Sub a_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles a.Tick
  52. paddle.Left = paddle.Left - 10
  53. End Sub
  54.  
  55. Private Sub d_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles d.Tick
  56. paddle.Left = paddle.Left + 10
  57. End Sub
  58.  
  59. Private Sub bomb_timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bomb_timer.Tick
  60. For i = 0 To 19
  61. missiles(i).Top = missiles(i).Top + 10
  62. Next
  63.  
  64. If score = 19 Then
  65. bomb_timer.Stop()
  66. a.Stop()
  67. d.Stop()
  68. Dim RD = MsgBox("A Bomb has exploded!", MsgBoxStyle.OkOnly, "DEAD")
  69. If RD = MsgBoxResult.Ok Then Close()
  70. End If
  71.  
  72. For i = 0 To 19
  73. If missiles(i).Visible = True And missiles(i).Bounds.IntersectsWith(paddle.Bounds) Then
  74. missiles(i).Visible = False
  75. score = score + 1
  76. ElseIf missiles(i).Visible = True And missiles(i).Top >= 710 Then
  77. bomb_timer.Stop()
  78. a.Stop()
  79. d.Stop()
  80. explosion.BringToFront()
  81. explosion.Visible = True
  82. Dim RD = MsgBox("A Bomb has exploded!", MsgBoxStyle.OkOnly, "DEAD")
  83. If RD = MsgBoxResult.Ok Then Close()
  84. End If
  85. Next
  86. End Sub
  87. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement