Marquee image box

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2009
Posts: 6
Reputation: Razza92 is an unknown quantity at this point 
Solved Threads: 0
Razza92 Razza92 is offline Offline
Newbie Poster

Marquee image box

 
0
  #1
Mar 14th, 2009
Hello. I am developing a game and for this game 2 of my sprites appear to be flying to the right. i have acomplished this by allowing an image box with the skay on to scroll accross my form from the right to the left. however, once the image has scrolled off the screen i can not get it to reset it self so that it it can scroll continuously.

back_star = my timer
sky = the image of the sky

  1. Private Sub Form_Load()
  2. back_star.Enabled = True
  3. back_star.Interval = 1
  4. End sub
  5.  
  6. Private Sub back_star_Timer()
  7. back_star.Enabled = True
  8. If back_star.Enabled = True Then
  9. sky.Left = sky.Left - 50
  10. Else
  11. If sky.Left <=sky.Left -4920 then
  12.  
  13. sky.Left = sky.Left + 0
  14. End If
  15. End If
  16.  
  17. End Sub

This is my code.

please could you take a look and show me where i have gone wrong or any alternative coding.
Last edited by Razza92; Mar 14th, 2009 at 11:20 am. Reason: missed some code
Reply With Quote Quick reply to this message  
Join Date: Dec 2002
Posts: 461
Reputation: waynespangler is on a distinguished road 
Solved Threads: 56
waynespangler waynespangler is offline Offline
Posting Pro in Training

Re: Marquee image box

 
0
  #2
Mar 15th, 2009
You must be using vb6.
Your timer logic is wrong.
1. when you come into the timer you are setting the timer enable and then checking to see if it is enabled. Which will allways be true.
2. The timer will not fire unless it is enabled which causes the above to happen again.
Try this code.
  1. Option Explicit
  2.  
  3. Private Sub Form_Load()
  4. back_star.Enabled = True
  5. back_star.Interval = 1
  6. End Sub
  7.  
  8. Private Sub back_star_Timer()
  9. sky.Left = sky.Left - 50
  10. If sky.Left < -sky.Width Then
  11. sky.Left = Me.ScaleWidth
  12. End If
  13. End Sub
Wayne

It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC