The forums have been somewhat slow lately, but here's my question anyways...


ok, I'm trying to make a version of BreakOut, but I'm not entirely sure of how to make the bricks dissapear as the ball hits them. I have this:

VB Code:
  1. Public Sub BlockSub(Ball As Shape, Brick As Shape)
  2.  
  3. If Ball.Top + Ball.Height = Brick.Top Then
  4.     YSpeed = -YSpeed
  5.     Ball.Top = Ball.Top + YSpeed
  6.     Paddle.Visible = False
  7. End If
  8.  
  9. If Ball.Top = Brick.Top + Brick.Height Then
  10.     YSpeed = -YSpeed
  11.     Ball.Top = Ball.Top + YSpeed
  12.     Paddle.Visible = False
  13. End If
  14.  
  15. 'If Ball.Top + Ball.Height < Paddle.Top And Ball.Left >= Paddle.Left Then
  16. '    YSpeed = -YSpeed
  17. '    Ball.Top = Ball.Top + YSpeed
  18. 'Paddle.Visible = False
  19. 'End If
  20.  
  21. If Ball.Left + Ball.Width = Brick.Left Then
  22.     XSpeed = -XSpeed
  23.     Ball.Left = Ball.Left + XSpeed
  24.     Paddle.Visible = False
  25. End If
  26.  
  27. If Ball.Left = Brick.Left + Brick.Width Then
  28.     XSpeed = -XSpeed
  29.     Ball.Left = Ball.Left + XSpeed
  30.     Paddle.Visible = False
  31. End If
  32.  
  33. End Sub

Most of the stuff in there is just nonsense, but it's the principle of the thing. I think it's in this that everything is going wrong...

But maybe it's also because all of the bricks are in a control array, and that I do it in a loop to check everything in the array.

Like this:

VB Code:
  1. For i = 0 to 15 'Number of bricks...
  2.      Call BlockSub(Ball, shape1(i)
  3. Next i

THERE ARE SO MANY FACTORS. Please help. Thanks in advance!

][KMx][