Topumuz her tarafa çarpıyor
Formumuzun üzerine bir shape ve 4 timer açıyoruz timer3 ile timer2 nin enabled özelliklerini false yapıyoruz
Private Sub Form_Load()
Timer1.Interval = 1
Timer2.Interval = 1
Timer3.Interval = 1
Timer4.Interval = 1
Form1.Width = 9180
Form1.Height = 8790
End Sub
Private Sub Timer1_Timer()
If Shape1.Left < 7962 Then
Shape1.Left = Shape1.Left + 80
Else
Timer2.Enabled = True
Timer1.Enabled = False
End If
End Sub
Private Sub Timer2_Timer()
If Shape1.Left > 0 Then
Shape1.Left = Shape1.Left - 80
Else
Timer2.Enabled = False
Timer1.Enabled = True
End If
End Sub
Private Sub Timer3_Timer()
If Shape1.Top > 0 Then
Shape1.Top = Shape1.Top - 80
Else
Timer4.Enabled = True
Timer3.Enabled = False
End If
End Sub
Private Sub Timer4_Timer()
If Shape1.Top < 7440 Then
Shape1.Top = Shape1.Top + 80
Else
Timer3.Enabled = True
Timer4.Enabled = False
End If
End Sub