Piglet
12-04-2005, 12:14 PM
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!
Thanks
Thanks
|
View Full Version : Animations?! Piglet 12-04-2005, 12:14 PM 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! Thanks boblarson 12-26-2005, 05:15 PM 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. D43x 01-20-2006, 11:24 PM 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). 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. blnFace = False End Sub ghudson 01-24-2006, 02:05 PM Check out my animatedgifs2.zip sample file in this thread for an example of how to simulate an animated GIF... Rotating Logo (http://www.access-programmers.co.uk/forums/showthread.php?t=49111) 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. D43x 01-29-2006, 08:25 PM Check out my animatedgifs2.zip sample file in this thread for an example of how to simulate an animated GIF... Rotating Logo (http://www.access-programmers.co.uk/forums/showthread.php?t=49111) 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... imgPlane.Left = imgPlane.Left + 100 ''Speed of Plane. 1=slow 1000=faster |