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:
Public Sub BlockSub(Ball As Shape, Brick As Shape) If Ball.Top + Ball.Height = Brick.Top Then YSpeed = -YSpeed Ball.Top = Ball.Top + YSpeed Paddle.Visible = False End If If Ball.Top = Brick.Top + Brick.Height Then YSpeed = -YSpeed Ball.Top = Ball.Top + YSpeed Paddle.Visible = False End If 'If Ball.Top + Ball.Height < Paddle.Top And Ball.Left >= Paddle.Left Then ' YSpeed = -YSpeed ' Ball.Top = Ball.Top + YSpeed 'Paddle.Visible = False 'End If If Ball.Left + Ball.Width = Brick.Left Then XSpeed = -XSpeed Ball.Left = Ball.Left + XSpeed Paddle.Visible = False End If If Ball.Left = Brick.Left + Brick.Width Then XSpeed = -XSpeed Ball.Left = Ball.Left + XSpeed Paddle.Visible = False End If 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:
For i = 0 to 15 'Number of bricks... Call BlockSub(Ball, shape1(i) Next i
THERE ARE SO MANY FACTORS. Please help. Thanks in advance!
][KMx][


Reply With Quote