Moving Car



This is an animation program, an example of the timer control in Visual Basic 6, where a car goes towards a tree. After understanding this sample program, you can make some interesting animations on your own.


                                                                >> DOWNLOAD 


Screenshot:
Moving Car animation using Timer control


Code:

Private Sub Command1_Click()
    If Command1.Caption = "Start" Then
        Command1.Caption = "Stop"
        Timer1.Enabled = True
    Else
        Command1.Caption = "Start"
        imgCar.Left = 4800
        imgCar.Top = 120
        Timer1.Enabled = False
    End If
End Sub
________________________________________________
Private Sub Timer1_Timer()
    If imgCar.Left > 2040 Then
        imgCar.Move imgCar.Left - 10, imgCar.Top + 5
    End If
End Sub