User Tag List

Results 1 to 3 of 3

Thread: Rounding issue when moving object by pixels; either too low or too high.

  1. #1
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)Universal Windows Platform Export Module (Steam)
    ratty's Avatar
    Join Date
    Apr 2012
    Posts
    1,165
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Rounding issue when moving object by pixels; either too low or too high.

    I have an active object that is set to the width of the frame, then positioned to the left of the frame. As the player progresses, this object is moved to the right pixel-by-pixel, to act as a progress meter. When progress equals 100%, the meter should then fill the entire width of the screen.

    The issue is that the 'progress' is a different variable each time, though the screen and object width are constant (1366px in this instance). Let's say 'progress' is '180' steps. If I simply dividng 1366/180, I get 7.58.

    Now, as each step of progress is completed, I move the object by either 7 or 8 pixels. If I go with 7, the object doesn't fill the entire screen when completion is 100% (step 180, in this example). If I go with 8 pixel movement per step, then the object fills the screen too soon.

    How do you guys handle an issue such as this?

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Instead of "adding" whole pixels for each step,
    you can simply set object X position to:

    (screenwidth/180.0) * progress

    this should take care of everything

  3. #3
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)Universal Windows Platform Export Module (Steam)
    ratty's Avatar
    Join Date
    Apr 2012
    Posts
    1,165
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by schrodinger View Post
    Instead of "adding" whole pixels for each step,
    you can simply set object X position to:

    (screenwidth/180.0) * progress

    this should take care of everything
    Oh my, what a simple solution. Thanks!

Similar Threads

  1. Replies: 2
    Last Post: 7th May 2016, 11:05 AM
  2. Bouncing issue off moving/rotating object
    By KLiK-iT in forum Fusion 2.5
    Replies: 7
    Last Post: 23rd April 2016, 05:57 AM
  3. Moving actives cut out pixels
    By SuperDisk in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 8th February 2013, 09:33 PM
  4. Rounding issue
    By pikzilla in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 4th July 2011, 09:54 PM

Posting Permissions

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