User Tag List

Results 1 to 10 of 10

Thread: How to use X Position of object when it changes as the screen scrolls?

  1. #1
    No Products Registered

    Join Date
    Oct 2015
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to use X Position of object when it changes as the screen scrolls?

    So I have a scroller on a scroll bar that is on a layer set to coefficient 0 and non of them move with the frame.

    I want to do calculations that use the X position of the Scroller along the scroll bar, but when the screen scrolls this X position changes because the screen has scrolled messing up my maths.


    So how do I get the position of the scroller along the scroll bar without using the X position?

  2. #2
    No Products Registered

    Join Date
    Oct 2015
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess the distance between the scroller and the ends of the bars would always be the same even if their actual X value changes as the screen scrolls?

  3. #3
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    679
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Correct. You could use:

    Abs( (left edge of bar - x position of scroller) )

    And that should work.

  4. #4
    No Products Registered

    Join Date
    Oct 2015
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, so then I can use:
    (Screen width/2) + (This value * something)
    To make the screen scroll

  5. #5
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    679
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    You wouldn't use the screen width/2, you would use the center of the screen/2+ your value, if you want to scroll that way. It would look like:

    center horizontal position to:
    - ((x left frame+x right frame)/2)+(This value*something)

  6. #6
    No Products Registered

    Join Date
    Oct 2015
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the help, appologies if I'm being thick

    Isn't the screen width/2 the same as x left frame+x right frame)/2?

    Say the screen was 500 pixels wide this would be 500/2=250
    and x left frame would be 0 and x right 500 , 0+500/2=250

    I'm missing something aren't I?

  7. #7
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    679
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    If you simply use 250+speed (i'll use 5 pixels as an example) you're only doing addition to the base value, 250, which never changes. 250+5 will always = 255, so your screen never goes anywhere.

    Using (x left frame+x right frame)/2 will always get the center of the window as the first value, and then speed will be added to that. So say the screen center starts off at 250, then 5 pixels of speed are added to that. The new center of the screen is now 255. 5 more pixels are added, and now the new center is 260. This way the frame will keep moving along.

    Technically, you could do it the first way, but you would need to add a value that is always incrementing each frame (i.e, 5 to 10 to 15 to 20 etc). Much simpler to just use the center of the screen.

    Here's an example of what I mean: screen center vs half of screen.mfa

  8. #8
    No Products Registered

    Join Date
    Oct 2015
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah okay, but I'm doing a scroll bar so the user is dragging the scroller button which in turn makes the BG scroll.

  9. #9
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    679
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Oh I see. I thought you were just asking about scrolling in general. You would use your method, then!

  10. #10
    No Products Registered

    Join Date
    Oct 2015
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good to know! But thanks for the information, it's all helping me learn.

Similar Threads

  1. Replies: 3
    Last Post: 2nd December 2014, 02:54 PM
  2. Screen position relative to taskbar position?
    By Raylax in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 2nd April 2009, 08:55 PM
  3. Wrapping a background that scrolls?
    By arsdigita in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 24th October 2006, 08:28 AM

Posting Permissions

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