This is my code, I make the ball bounce to the right. But how can I bounce it back when I press Left (Command2), I have a problem on the if statement. I cannot get the logic how can I stop the ball when it reaches the end frame of the form on the left side. As same as when I click DOWN and UP.
Private Sub Command3_Click() Timer1.Enabled = True End Sub 'Right Private Sub Timer1_Timer() If Shape1.Top <= Form1.ScaleHeight - Shape1.Height And Shape1.Left < Form1.ScaleWidth - Shape1.Width Then Shape1.Top = Shape1.Top + 100 Shape1.Left = Shape1.Left + 20 Else Timer1.Enabled = False Timer2.Enabled = True End If End Sub 'Right Private Sub Timer2_Timer() If Shape1.Left > 0 And Shape1.Top > 0 Then Shape1.Top = Shape1.Top - 100 Shape1.Left = Shape1.Left + 20 Else Timer1.Enabled = True Timer2.Enabled = False End If End Sub