hola gente toy haciendo el juego de los ladrillos pero me trave en una parte , que es en la que tengo que hacer que la bola rebote en la plataforma , hice que rebote en las paredes pero o se como hacer que rebote en la plataforma , la pataforma se mueve.
bola se llama = bola
el cuadrado , bue paredes = shape1
plataforma = linea
timer= timer 1
---------------------------------------
Dim xx As Integer
Dim yy As Integer
Dim x As Integer
Dim y As Integer
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 97 And linea.Left > 240 Then
linea.Left = linea.Left - 300
End If
If KeyAscii = 100 And linea.Left < 9840 Then
linea.Left = linea.Left + 300
End If
If KeyAscii = 119 And linea.Top > 4560 Then
linea.Top = linea.Top - 300
End If
If keyaascii = 115 And linea.Top < 4620 Then
linea.Top = linea.Top + 300
End If
End Sub
Private Sub Form_Load()
xx = 50
yy = 35
End Sub
Private Sub KBRD_Timer()
End Sub
Private Sub Timer1_Timer()
Dim i#
For i = 0 To bola.Count - 1
bola(i).Left = bola(i).Left + xx
bola(i).Top = bola(i).Top + yy
Next
For i = 0 To bola.Count - 1
If bola(i).Left < Shape1.Left Or bola(i).Left + bola(i).Width > Shape1.Left + Shape1.Width Then
xx = -xx
End If
Next
For i = 0 To bola.Count - 1
If bola(i).Top < Shape1.Top Or bola(i).Top + bola(i).Height > Shape1.Top + Shape1.Height Then
yy = -yy
End If
Next
End Sub
imagen :