Animation in VB6

Last week I had discussed a tutorial in animations using vb.net - VB.NET animation So now, we will create a version on vb6.0 about this animation tutorial. Now, let's start this tutorial! 1.Let's start this tutorial by following the following steps in Microsoft Visual Basic 6.0: Open Microsoft Visual Basic 6.0, click Choose Standard EXE, and click Open. 2. Next, add two Buttons named Button1 and labeled it as "Go" and Button2 labeled as "Stop". Add one Image named Image1 and have any image load in it; the location property must be Left:120, Top:2040. Add also a Timer named Timer1 and put 1 as the time interval of the timer. You must design your interface like this: design 3. Now put this code for your code module.
  1. Private Sub Timer1_Timer()
  2. Image1.Left = Image1.Left + 10
  3. If Image1.Left >= 2600 Then
  4. Image1.Top = Image1.Top - 10
  5. Image1.Left = Image1.Left + 10
  6. End If
  7. End Sub
  8.  
  9. Private Sub Form_Load()
  10. Timer1.Enabled = False
  11. End Sub
  12.  
  13. Private Sub Command1_Click()
  14. Timer1.Enabled = True
  15. End Sub
  16.  
  17. Private Sub Command2_Click()
  18. Timer1.Enabled = False
  19. End Sub

Explanation:

We create a method for the Timer for Ticking or Starting the time. As the timer will start the position of our Image will increment by 10 (Note that our default value of left location of the image is 120) in its Left Location. If the Image will be greater than or equal to the Left location of 2600, then it will again increment to the left location by 10 and the top location will decrement by 10; means that the Image will move to the right and will go up or to the top as it decrements the top location by 10 and will go right side again for incrementing again the left side by 10. Button1/Command1 is for the Go Button, meaning to say that timer must be enabled so that the Image will move with regards to the Timer1.Enabled = True. Button2/Command2 is the Stop Button and will used to stop the Image for moving as we have the code of disabling the timer,Timer1.Enabled = False.

Output:

output output Download the source code and try it! :) For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below. Best Regards, Engr. Lyndon Bermoy IT Instructor/System Developer/Android Developer/Freelance Programmer Mobile: 09488225971 Landline: 826-9296 E-mail:[email protected] Add and Follow me on Facebook: https://www.facebook.com/donzzsky Visit and like my page on Facebook at: https://www.facebook.com/BermzISware

Comments

I am creating a game, a action game. I need help. if there's some who has created any can help me by joining me Facebook. My name on FB is "Xain A. Latif". Thank you. I use VB6.

Add new comment