Results 1 to 3 of 3

Thread: 1-Twip vs. 3-Pixel HELP!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202

    Unhappy 1-Twip vs. 3-Pixel HELP!

    Sub DoBall()

    Speed = 5
    xFlag = 1
    yFlag = 1

    If xFlag = 1 Then
    Ball.X = Ball.X + Speed
    Else
    Ball.X = Ball.X - Speed
    End If

    If yFlag = 1 Then
    Ball.Y = Ball.Y + Speed
    Else
    Ball.Y = Ball.Y - Speed
    End If

    If Ball.X >= Form1.width Then
    xFlag = 0
    End If

    If Ball.X <= 100 Then
    xFlag = 1
    End If

    If Ball.Y >= Form1.height Then
    yFlag = 0
    End If

    If Ball.Y <= 100 Then
    yFlag = 1
    End If

    End Sub

    The above code works when Form property is set to 1-Twip, but when I change it to 3-Pixel the code no longer works. The ball flies of the form. Why? Please help!

    Thanks

  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    The number of pixels is the resolution like 768 X 1024.

    Twips are fixed at 1440 per inch. As you change resolution you get a different number of twips per pixel. Pixels are always much bigger than twips. So if you move your ball 150 twips - it isn't far, but 150 pixels can be 1/6 of the entire screen width, nearly as big as a form.
    Last edited by jim mcnamara; Aug 12th, 2002 at 04:35 PM.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202

    Thumbs up

    Oh ok. Thanks for clearing that up for me. Yeh, I just change all my numbers to much lower numbers and everything works!

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