Please help me guys.
Im trying to create a program where i have a car racing a plane.
So far everything is alright except my plane won't move and only the car moves.

This is my code in VB6 format

'we need two counters to store the number of wins for each racer
Dim CarWins As Integer
Dim PlaneWins As Integer
Private Sub Command2_Click()

'move the pics back to the left
Picture1.Left = 120
Picture2.Left = 120

'stop the timers
Timer1.Enabled = False
Timer2.Enabled = False
End Sub
Private Sub Command1_Click()

'randomly set timer intervals which affect racing speeds
Timer1.Interval = Int(Rnd * 100) + 100 'creates a random number between 100 and 200
Timer2.Interval = Int(Rnd * 100) + 100 'creates a random number between 100 and 200

'turn on the timers
Timer1.Enabled = True
Timer2.Enabled = True

End Sub
Private Sub Form_Load()
'set the counters to zero
CarWins = 0
PlaneWins = 0
End Sub
Private Sub Timer1_Timer()

'if the picture hasn't crossed the line, then move it a bit more
If Picture1.Left <= Line1.X1 Then
Picture1.Left = Picture1.Left + 120
Else
Timer2.Enabled = False
CarWins = CarWins + 1
Timer1.Enabled = False
End If

'refresh the labels displaying the number of wins
label2.Caption = CarWins
label3.Caption = PlaneWins

End Sub
Private Sub Timer2_Timer()

'if the picture hasn't crossed the line, then move it a bit more
If Picture1.Left <= Line1.X1 Then
Picture1.Left = Picture1.Left + 120
Else 'turn off the timers and add one to the counter
Timer1.Enabled = False
PlaneWins = PlaneWins + 1
Timer2.Enabled = False
End If

'refresh the labels displaying the number of wins
label2.Caption = CarWins
label3.Caption = PlaneWins

End Sub

It looks like in both timer events (1 and 2) you are moving only Picture1... Should not timer2 be moving Picture2?

Good Luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.