ayuda para finalizar codigo
tengo este codigo que hace que una foto valla por todo el form rebotando en las esquinas,ahora como puedo cambiar de una foto a otra en cada movimiento o sea tengo 6 fotos; 3 de ellas si se ven una detra de otra crea la ilusion del muñeco moviendose hacia la derecha y las otra 3 hacia la izquierda.:pregunta
como puedo decirle al programa que cuando el muñeco corre a la derecha valla intercambiando las 3 fotos de la derecha para hacer la ilusion y cuando rebote que cambie a las fotos de la izquierda.gracias
Dim stopit As Boolean
Dim imagenes(11) As Picture
Dim z As Integer
Dim x, y As Integer
Private Sub Command1_Click()
Form1.Scale (0, 0)-(100, 100)
Set imagenes(0) = LoadPicture(App.Path & "Gifs" & "bill1r.gif") 'right
Set imagenes(1) = LoadPicture(App.Path & "Gifs" & "bill2r.gif") 'right
Set imagenes(2) = LoadPicture(App.Path & "Gifs" & "bill3r.gif") 'right
Set imagenes(3) = LoadPicture(App.Path & "Gifs" & "bill1l.gif") 'left
Set imagenes(4) = LoadPicture(App.Path & "Gifs" & "bill2l.gif") 'left
Set imagenes(5) = LoadPicture(App.Path & "Gifs" & "bill3r.gif") 'left
stopit = False
Do While (stopit = False)
DoEvents
Cls
x = x + 1
y = y + 1
PaintPicture imagenes(z), x, y
If (x > 90) Then
deltax = deltax * Rnd
deltax = deltax - 1
ElseIf (y > 76) Then
deltay = deltay * Rnd
deltay = deltay - 1
ElseIf (y < 0) Then
deltay = deltay * Rnd
deltay = deltay + 1
ElseIf (x < 0) Then
deltax = deltax * Rnd
deltax = deltax + 1
End If
x = x + deltax
y = y + deltay
For i = 0 To 1000000
Next
Cls
Loop
End Sub
Private Sub Command2_Click()
stopit = True
End Sub
Private Sub Form_Click()
stopit = True
Dim z As Integer
Set imagenes(6) = LoadPicture(App.Path & "Gifs" & "bdeath1.gif") 'explode1
Set imagenes(7) = LoadPicture(App.Path & "Gifs" & "bdeath2.gif") 'explode2
Set imagenes(8) = LoadPicture(App.Path & "Gifs" & "bdeath3.gif") 'explode3
Set imagenes(9) = LoadPicture(App.Path & "Gifs" & "bdeath4.gif") 'explode4
Set imagenes(10) = LoadPicture(App.Path & "Gifs" & "bdeath5.gif") 'explode5
For z = 6 To 10
Cls
PaintPicture imagenes(z), x, y
For i = 0 To 10000000
Next
Cls
Next
Cls
End Sub
como puedo decirle al programa que cuando el muñeco corre a la derecha valla intercambiando las 3 fotos de la derecha para hacer la ilusion y cuando rebote que cambie a las fotos de la izquierda.gracias
Dim stopit As Boolean
Dim imagenes(11) As Picture
Dim z As Integer
Dim x, y As Integer
Private Sub Command1_Click()
Form1.Scale (0, 0)-(100, 100)
Set imagenes(0) = LoadPicture(App.Path & "Gifs" & "bill1r.gif") 'right
Set imagenes(1) = LoadPicture(App.Path & "Gifs" & "bill2r.gif") 'right
Set imagenes(2) = LoadPicture(App.Path & "Gifs" & "bill3r.gif") 'right
Set imagenes(3) = LoadPicture(App.Path & "Gifs" & "bill1l.gif") 'left
Set imagenes(4) = LoadPicture(App.Path & "Gifs" & "bill2l.gif") 'left
Set imagenes(5) = LoadPicture(App.Path & "Gifs" & "bill3r.gif") 'left
stopit = False
Do While (stopit = False)
DoEvents
Cls
x = x + 1
y = y + 1
PaintPicture imagenes(z), x, y
If (x > 90) Then
deltax = deltax * Rnd
deltax = deltax - 1
ElseIf (y > 76) Then
deltay = deltay * Rnd
deltay = deltay - 1
ElseIf (y < 0) Then
deltay = deltay * Rnd
deltay = deltay + 1
ElseIf (x < 0) Then
deltax = deltax * Rnd
deltax = deltax + 1
End If
x = x + deltax
y = y + deltay
For i = 0 To 1000000
Next
Cls
Loop
End Sub
Private Sub Command2_Click()
stopit = True
End Sub
Private Sub Form_Click()
stopit = True
Dim z As Integer
Set imagenes(6) = LoadPicture(App.Path & "Gifs" & "bdeath1.gif") 'explode1
Set imagenes(7) = LoadPicture(App.Path & "Gifs" & "bdeath2.gif") 'explode2
Set imagenes(8) = LoadPicture(App.Path & "Gifs" & "bdeath3.gif") 'explode3
Set imagenes(9) = LoadPicture(App.Path & "Gifs" & "bdeath4.gif") 'explode4
Set imagenes(10) = LoadPicture(App.Path & "Gifs" & "bdeath5.gif") 'explode5
For z = 6 To 10
Cls
PaintPicture imagenes(z), x, y
For i = 0 To 10000000
Next
Cls
Next
Cls
End Sub
