lunes, 12 de noviembre de 2007

CARROS Y SEMAFOROS







CODIGO_______________________________________________________________
Private Sub Form_Load()
Shape1.Visible = False
Shape2.Visible = False
Shape3.Visible = False
Shape5.Visible = False
Shape6.Visible = False
Shape7.Visible = False
End Sub
Private Sub Timer1_Timer()


'activa el semaforo
Form2.Caption = Val(Form2.Caption) + 1
Shape1.Visible = True
Shape2.Visible = False
Shape3.Visible = False
If Form2.Caption > 5 Then
Shape1.Visible = False
Shape2.Visible = True
Shape3.Visible = False
If Form2.Caption > 10 Then
Shape1.Visible = False
Shape2.Visible = False
Shape3.Visible = True
If Form2.Caption > 15 Then
Shape1.Visible = False
Shape2.Visible = True
Shape3.Visible = False
If Form2.Caption > 20 Then
Shape1.Visible = True
Shape2.Visible = False
Shape3.Visible = False
Form2.Caption = "0"
End If
End If
End If
End If
End Sub
Private Sub Timer2_Timer()


'mueve el carro de derecha a izquierda
a.Caption = Val(a.Caption) + 1
If a.Caption > 10 Then
carro.Left = 500
If a.Caption > 11 Then
carro.Left = 1000
If a.Caption > 12 Then
carro.Left = 1500
If a.Caption > 13 Then
carro.Left = 2000
If a.Caption > 14 Then
carro.Left = 2500
If a.Caption > 15 Then
carro.Left = 3000
If a.Caption > 16 Then
carro.Left = 3500
If a.Caption > 17 Then
carro.Left = 4000
If a.Caption > 18 Then
carro.Left = 4500
If a.Caption > 19 Then
carro.Left = 5000
If a.Caption > 20 Then
carro.Left = 5500
If a.Caption > 21 Then
carro.Left = 6000
If a.Caption > 31 Then
carro.Left = 6500
If a.Caption > 32 Then
carro.Left = 7000
If a.Caption > 33 Then
carro.Left = 7500
If a.Caption > 34 Then
carro.Left = 8000
If a.Caption > 35 Then
carro.Left = 9000
If a.Caption > 36 Then
carro.Left = 10000
If a.Caption > 37 Then
carro.Left = 11000
If a.Caption > 38 Then
carro.Left = 12000
If a.Caption > 39 Then
a.Caption = "0"
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End Sub

Private Sub Timer3_Timer()


'activa el semaforo
Shape7.Visible = True
Shape6.Visible = False
Shape5.Visible = False
If Form2.Caption > 5 Then
Shape7.Visible = False
Shape6.Visible = True
Shape5.Visible = False
If Form2.Caption > 10 Then
Shape7.Visible = False
Shape6.Visible = False
Shape5.Visible = True
If Form2.Caption > 15 Then
Shape7.Visible = False
Shape6.Visible = True
Shape5.Visible = False

If Form2.Caption > 20 Then
Shape7.Visible = True
Shape6.Visible = False
Shape5.Visible = False
End If
End If
End If
End If

End Sub

Private Sub Timer4_Timer()


'mueve el carro de izquierda a derecha
b.Caption = Val(b.Caption) + 1
If b.Caption > 0 Then
carro1.Left = 12500
If b.Caption > 1 Then
carro1.Left = 12000
If b.Caption > 2 Then
carro1.Left = 11000
If b.Caption > 3 Then
carro1.Left = 10000
If b.Caption > 4 Then
carro1.Left = 9000
If b.Caption > 5 Then
carro1.Left = 8000
If b.Caption > 6 Then
carro1.Left = 7000
If b.Caption > 7 Then
carro1.Left = 6000
If b.Caption > 8 Then
carro1.Left = 5000
If b.Caption > 9 Then
carro1.Left = 4500
If b.Caption > 10 Then
carro1.Left = 4000
If b.Caption > 17 Then
carro1.Left = 3000
If b.Caption > 18 Then
carro1.Left = 2000
If b.Caption > 19 Then
carro1.Left = 1000
If b.Caption > 20 Then
carro1.Left = 1000
If b.Caption > 21 Then
carro1.Left = 500
If b.Caption > 22 Then
carro1.Left = 250
If b.Caption > 23 Then
carro1.Left = 100
b.Caption = "0"
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End Sub