Results 1 to 6 of 6

Thread: Image moved with timer is screwed up. Help

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Posts
    9

    Post

    I am trying to move an Image with a timer. The timer's interval is set to 50 and it moves the image 5 pixels to the right. After a while of moving it something strange happens. Instead of it moving 5 to the right, 5 to the right, 5 to the right, etc. it moves 4 or 6 to the right. The the image's left property is sometimes 159 and 176 etc. This is a bit odd. Does anyone know what's going on and how to fix it? Thanx.

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923

    Post

    Enclose code in the code tag which I cannot type otherwise it will think i'm writing code! If [ is <, then the code tag is <code>your code here</code>

  3. #3
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485

    Post

    If you have globals check them against your local variables (if your not declaring). Post the code. It could be a couple of things like the initialization of your variable in a For statement which might waver between 0 + 1, or the timer beginning again when a for ending statement is reached.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Posts
    9

    Post

    Private Sub Timer3_Timer()
    MM 3
    Label1 = Worm(0).Left + (Worm(0).Width - 1) 'to check the left property
    If Timer1 = False Then Timer1 = True
    If Worm(0).Left >= 0 Then
    If fast = 0 Then
    Worm(0).Move Worm(0).Left - 5
    Else
    Worm(0).Move Worm(0).Left - 15
    End If
    End If
    End Sub

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Posts
    9

    Post

    how come my code here isn't formatted?

  6. #6

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Posts
    9

    Post

    I figured out how to fix it but I still don't know why that was happening.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width