St4nley
Member
- Apr 13, 2013
- 469
- 76
Ok so i'm making pong, i got basically all collision start from space bar but, when it collides even if the paddle isnt there it'll still collide and go back the other way,
heres my code
if you have vb6 and want to try this yourself then i can simply send you a paddle and a ball to implement this yourself.
heres my code
Code:
Dim goodVel As Integer
Dim goodvel1 As Integer
Private Sub Form_Load()
goodVel = 50
goodvel1 = 0
End Sub
Private Sub Timer1_Timer()
imgball.Left = imgball.Left - goodvel1
If imgball.Left + imgball.Width > imgPaddle.Left + 400 Then
goodvel1 = goodvel1 * -1
End If
If imgball.Left < imgPaddle.Height - 1000 Then
goodvel1 = goodVel * -1
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
imgPaddle.Top = Y
imgPaddle.Width = Form2.ScaleHeight
End If
End Sub
Private Sub Form_keydown(keycode As Integer, Shift As Integer)
If keycode = vbKeySpace Then
goodvel1 = goodVel * -1
imgball.Top = imgball.Top - goodVel
End If
End Sub
if you have vb6 and want to try this yourself then i can simply send you a paddle and a ball to implement this yourself.