Título: Ayuda con movimientos de imagenes
Publicado por: reeyesg en 16 Junio 2015, 21:28 pm
Hola bnas tardes quisiera una pequeña ayuda cn mi progrma q es una simulacion de cajeros de una clinica quisiera que cuando la imagen1 llegue a la posicion de las otras 3 imagenes ellas suban pero claro el image1 q regrese a su posicion inicial aqui lo q he hecho Dim cont As Integer Dim contc As Integer Private Sub Command1_Click() Dim num As Integer Randomize num = Int((3) * Rnd + 1) Text7.Text = num cont = 0 Timer1.Enabled = True Timer1.Interval = 1000 tiempo = InputBox("Escriba el tiempo de Simulacion", "Simulacion de Clinica") Label7.Caption = tiempo End Sub Private Sub Timer1_Timer() Select Case Val(Text7.Text) Case 1: Image1.Left = Image1.Left - 20 If (Image1.Left = -3480) Then Image2.Top = Image2.Top + 20 End If Case 2: Image1.Left = Image1.Left - 20 If (Image1.Left = 2160) Then Image3.Top = Image2.Top + 20 End If Case 3: Image1.Left = Image1.Left - 20 If (Image1.Left = 840) Then Image2.Top = Image2.Top + 20 End If End Select
el boton q esta en la parte de arriba solo es referencia q ahi van ·cajeros, porfa una ayudita (http://i61.tinypic.com/54g18m.jpg)
Título: Re: Ayuda con movimientos de imagenes
Publicado por: Jacknori en 16 Junio 2015, 22:57 pm
reyeesg el movimiento de la imagen 1 es vectorial, asi que para que vuelva a su sitio debes restar el módulo de la imagen 1 en la posicion final entre la inicial. Es decir, tienes que restar a la posicion después de haberse movido de la imagen 1 su posicion al principio, cuando no se ha movido. El resultado es a distancia que ha recorrido la imaagen1, lo cual se lo vueles a restar a la posicion final para que te de su posicion antes de moverse por ultima vez. Despues que la imagen se haya cambiado de posicion, la mueves al principio de esa manera
Título: Re: Ayuda con movimientos de imagenes
Publicado por: reeyesg en 17 Junio 2015, 17:43 pm
Private Sub Command1_Click() Dim num As Integer Randomize num = Int((3) * Rnd + 1) Text1.Text = num Timer1.Enabled = True Timer1.Interval = 300 tiempo = InputBox("Escriba el tiempo") Label1.Caption = tiempo End Sub Private Sub Label1_Change() 'contador de clientes Select Case (num) Case 1: If Image1.Left = 5000 Then Label2.Caption = Label2 + 1 Image1.Left = 7000 End If Case 2: If Image1.Left = 3000 Then Label2.Caption = Label2 + 1 Image1.Left = 7000 End If Case 3: If Image1.Left = 1000 Then Label2.Caption = Label2 + 1 Image1.Left = 7000 End If End Select End Sub Private Sub Label2_Change() If Image1.Left = 5000 Then Randomize num = Int((3) * Rnd + 1) Text1.Text = num End If If Image1.Left = 3000 Then Randomize num = Int((3) * Rnd + 1) Text1.Text = num End If If Image1.Left = 1000 Then Randomize num = Int((3) * Rnd + 1) Text1.Text = num End If End Sub Private Sub Timer1_Timer() Label1.Caption = Label1.Caption - 1 Image1.Left = Image1.Left - 100 Select Case (num) Case 1: If Image1.Left = -5000 Then Image2.Visible = True Image1.Left = Image1.Left - 100 ElseIf Image2.Visible = True Then Image1.Left = -7000 End If Case 2: If Image1.Left = -3000 Then Image3.Visible = True Image1.Left = Image1.Left - 100 ElseIf Image3.Visible = True Then Image1.Left = -7000 End If Case 3: If Image1.Left = -1000 Then Image4.Visible = True Image1.Left = Image1.Left - 100 ElseIf Image4.Visible = True Then Image1.Left = -7000 End If End Select End Sub
Ve la imagen1 es la inicial esta en la posicion 7000 imagen 2=5000 imagen 3=3000 imagen 4= 1000 ahi me enrede ya, :s no pedo hacer q me funcione al pelo porq la idea q tengo es q cuando este visible las imagenes 2,3 y 4 en el otro timer meterle lo del movimieento para q suban a los cajeros, una vez en los cajeros debo hacerle otra cosa aleatoria para q genere aleatoriamente tipo de cliente(regular o preferencia) tipo de poliza( particular, por seguro o exonerado)
|