Can anybody give me any tips on how to integrate animations into VB6? I just need a character to move around on the screen. Im new to VB so please explain in detail!
Basically to have one pic move around, you just use a timer and on it's timer event you set the pic to change it's LEFT and TOP properties so it appears to move around.
For others, you would take multiple images that have intermediate steps and overlay them and display/hide each for each step using the same timer event.
To animate a chatacter you'd animate the "Label". Do you still need it?
Attached is my animated icon tho (the zip includes the form and image). A small airplane flies across the screen.
Here's the actual code... (green text are my comments not code).
[vbcode]
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
ChDrive App.Path ''Path of file used for project
ChDir App.Path
imgPlane.Left = -1500 ''Original starting position of plane (imgPlane)
imgPlane.Top = 750
End Sub
Private Sub TimerAnimate_Timer()
Static blnFace As Boolean
If (imgPlane.Left < 12000) And (imgPlane.Top > 500) Then ''When plane reaches far right of screen.
imgPlane.Left = imgPlane.Left + 100 ''Speed of Plane. 1=slow 1000=faster
imgPlane.Top = imgPlane.Top - 0
Else
imgPlane.Left = -500 ''Restore original position when plane goes off right side of screen.
imgPlane.Top = 750
End If
imgPlane.Picture = LoadPicture("jet_right_black.ico") ''imgPlane.Picture = LoadPicture("C:\WINDOWS\My Documents\jet_right_black.ico") CAN ALSO USE FULL PATH.
Check out my animatedgifs2.zip sample file in this thread for an example of how to simulate an animated GIF... Rotating Logo
D43x, I like your method but the image appears to have a stutter when moving across the screen. I have played with the speed since I had to slow it down a bit because of the speed of my processor.
Check out my animatedgifs2.zip sample file in this thread for an example of how to simulate an animated GIF... Rotating Logo
D43x, I like your method but the image appears to have a stutter when moving across the screen. I have played with the speed since I had to slow it down a bit because of the speed of my processor.
To get a smoother animation, change the Timer interval (click the Timer icon on the form - it'll be hidden so max the form), or increase/decrease the "100" in this line to suit your PC...