Public Class Form1
Dim tiempo As Integer
Dim x As Integer = 0
Dim y As Integer = 0
Dim ciclo As Integer = 0
Dim flip As Boolean = False
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
tiempo = 21
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If tiempo >= 0 Then
Label1.Text = tiempo
tiempo = tiempo - 1
Else
Timer1.Enabled = False
End If
semaforo()
End Sub
Public Sub timer_on()
If tiempo > 0 Then
Timer1.Enabled = True
Else
Timer1.Enabled = False
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
timer_on()
Timer2.Enabled = True
End Sub
Sub semaforo()
If tiempo = 20 Then
Me.PictureBox1.Image = My.Resources.verde
x = x + 7
ElseIf tiempo = 15 Then
Me.PictureBox1.Image = My.Resources.amarillo
x = 0
ElseIf tiempo = 10 Then
Me.PictureBox1.Image = My.Resources.rojo
x = 0
ElseIf tiempo = 5 Then
Me.PictureBox1.Image = My.Resources.verde
x = x - 7
flip = True
ElseIf tiempo = 0 Then
End
End If
End Sub
Sub caminando()
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
If ciclo Mod 6 = 0 Then
Me.PictureBox2.Image = My.Resources._21
Else
Me.PictureBox2.Image = My.Resources._11
End If
If flip = True Then
Me.PictureBox2.Image.RotateFlip(RotateFlipType.RotateNoneFlipX)
End If
Me.PictureBox2.Left = Me.PictureBox2.Left + x
ciclo += 2
End Sub
End Class
RUTA BLOG PROYECTOS
http://proyectosvb2008.blogspot.com
No hay comentarios:
Publicar un comentario