I need help with some code for this. I've got the paddle working, but I can't figure out how to get the bricks to disappear. I've attemted to code it, but no matter how i try it it doesn't work. I'll give you my code so far.

I reeealy hope this isn't some dumb newbie problem. Thanks for any help in advance!
EDIT: I'm using VB6

Timer1:

Private Sub Timer1_Timer()

'move the ball, based on the virtical and horizontal momenutm
Shape2.Top = Shape2.Top + vmom
Shape2.Left = Shape2.Left + hmom
'see if the ball is hitting the surface of the paddle


If (Shape2.Top + Shape2.Height) > Shape1.Top Then


    If Shape2.Left + Shape2.Width >= Shape1.Left And Shape2.Left <= Shape1.Left + Shape1.Width Then
            vmom = -vmom
    End If

End If

'see if the ball has hit the edge of the screen
For Index = 0 To 23
    If (Shape2.Top + Shape2.Height) > Shape1.Top Then
        If Shape3(Index).Visible = True Then
            If Shape2.Left + Shape2.Width >= Shape3(Index).Left And Shape2.Left <= Shape1.Left + Shape3(Index).Width Then
                vmom = -vmom
        End If
    End If

End If
Next
If (Shape2.Left + Shape2.Width) > Form1.Width Then
    Shape2.Left = Form1.Width - Shape2.Width
    hmom = -hmom 'this reverses it ball's direction
ElseIf Shape2.Left < 0 Then
    Shape2.Left = 0
    hmom = -hmom 'this reverses it ball's direction
ElseIf Shape2.Top < 0 Then
    Shape2.Top = 0
    vmom = -vmom 'this reverses it ball's direction
ElseIf Shape2.Top > Form1.Height Then
    MsgBox "You lost!", , "End Game!"
    Timer1.Enabled = False
End If
End Sub

Timer2:

fnum = fnum + 1
Label1.Caption = fnum
If Shape2.Top > Form1.Height Then Timer2.Enabled = False

Form_Load:

Randomize
    'make the vertical and horizontal momentums random
    vmom = -Int(Rnd * 200)
    hmom = -Int(Rnd * 200)

Command1(Start):

If Shape2.Top > Form1.Height Then
    Shape2.Left = 3360
    Shape2.Top = 240
    fnum = 0
    Label1.Caption = 0
    Randomize
    vmom = Int(Rnd * 200)
    hmom = Int(Rnd * 200)
End If
Timer1.Enabled = True
Timer2.Enabled = True

Command2(Stop):

Timer1.Enabled = False
Timer2.Enabled = False

Form_Click:

Command1_Click
Dim vmom As Integer 'holds the ball's vertical momentum
Dim hmom As Integer 'holds the ball's horizontal momentum
Dim fnum As Integer

Any help would be much appreciated! Tanks for taking the time to read this!

Bump?

With a quick glance... I don't see the relavent code that shows where you detect the collision of a ball with a brick. I see the walls but not the ball hitting the brick...

Good Luck

Ah, sorry, I used an earlier version of my code XO
Anyways, I've been playing around with it, and eventually got it to work. Sorry for wasting your time .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.