You probably just want to use either a global variable or a local, static variable to retain your pointer to which picture is being used. An example might be:
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Static iImgPtr as Integer 'will be initialized to 0 on the first call to this routine!
iImgPtr = (iImgPtr + 1) Mod 3 'this will make iImgPtr sequence 0,1,2,0,1...
IMGSelf.Picture = IMGwalk(iImgPtr).Picture 'update yourself with new image
If KeyCode = vbKeyUp Then
IMGSelf.Top = IMGSelf.Top - 435
End If
If KeyCode = vbKeyDown Then
IMGSelf.Top = IMGSelf.Top + 435
End If
If KeyCode = vbKeyLeft Then
IMGSelf.Left = IMGSelf.Left - 300
End If
If KeyCode = vbKeyRight Then
IMGSelf.Left = IMGSelf.Left + 300
End If
End Sub
|
__________________
"With the appearance of the AddressOf operator, an entire industry has developed among authors illustrating how to do previously impossible tasks using Visual Basic. Another industry is rapidly developing among consultants helping users who have gotten into trouble attempting these tasks." -Dan Appleman
|