User Tag List

Results 1 to 5 of 5

Thread: Silly little rounding qroblem

  1. #1
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Mar 2009
    Location
    Bethesda, MD
    Posts
    234
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Silly little rounding qroblem

    Simply put, I have alterable values which round off important additions. For instance, a very small amount is added every frame to a value representing the X scale of an object. The amount, 0.07, is simply never added to the value, and so of course the mechanism does not function. How can I defeat this?

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleUnicode Add-on

    Join Date
    Nov 2010
    Location
    Switzerland
    Posts
    301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Pikzilla,

    i just tried it and for me it works. I just added two Condition/Actions to the Frame and it works for me.

    I' ve inserted a String-Object to display the Value of "Global Value A"

    1. + Always
    - Set alterable String to Str$(Global Value A)
    2. + User clicks with left Button
    - Add 0.07 to Global Value A

    Thats it. For me it works. The String Object displays 0 at start and on every click it adds 0.07 to the Global Value A (ex. 0.07, 0.14, 0.21, 0.28, 0.35, 0.42, and so on).

    Greets

    jahkri

  3. #3
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Mar 2009
    Location
    Bethesda, MD
    Posts
    234
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for helping me out here.

    I couldn`t really put my finger on how what I was trying to do differed from yours, so I just spliced out the relevant bits and stuck them in their own file.
    http://www.mediafire.com/?ovj7c9622l486b6

    Pretty simple setup, really. The laser objects are created on the boss, angled toward the red square, then put into a period of growth, where their value spd is added every frame to their value Growtimer, until they grow to a certain amount and start moving toward the square. The spd value is divided by 100 to account for the fact that the laser sprite is one hundred pixels long. Thus, the pixel length of the sprite is one hundred times the growtimer value. Of course, growtimer somehow has a habit of hanging out at zero forever, so none of this actually happens.

    In the past, the laser sprite was only a single pixel long, and the spd value was never divided. That worked fine, and the fact that the change here caused the problem leads me to believe that the issue is with rounding.

  4. #4
    Clicker Multimedia Fusion 2 Developer
    gastrop0d's Avatar
    Join Date
    Dec 2011
    Location
    Australia
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try dividing by 100.0 rather than 100. In fact turn every single operand into a non-integer. When I'm having trouble with stuff like this I will go to an extreme like:

    d = ((x*1.0 / p*1.0) + 5.0) * 40.0

    That way it is CERTAIN that everything in the equation is being treated as a float and nothing is being truncated or rounded off.

  5. #5
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Mar 2009
    Location
    Bethesda, MD
    Posts
    234
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Boy, that was simple!
    Thanks to everyone for helping me with my stupid little problem here!

Similar Threads

  1. Rounding issues
    By Arnax in forum Android Export Module Version 2.0
    Replies: 1
    Last Post: 24th February 2012, 08:17 AM
  2. Rounding Down Counters
    By etrose in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 13th November 2011, 09:41 PM
  3. Rounding Down
    By etrose in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 7th November 2011, 11:32 AM
  4. Rounding issue
    By pikzilla in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 4th July 2011, 09:54 PM
  5. Rounding up/down
    By MechatheSlag in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 17th June 2007, 11:43 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
  •