User Tag List

Results 1 to 7 of 7

Thread: Help with floating numbers

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with floating numbers

    Hi all

    I'm having trouble using floating numbers in my game. It's an on rails game. In the game, the platforms move from right to left instead of the character.
    The platforms move according to a global speed variable, runSpeed, which starts at a value of 1.
    Then I've said, "restrict actions for 5 seconds > Add 0.1 to runSpeed".
    When I try adding 0.1 to the runSpeed, rather than all of the platforms speeding up evenly, they all start moving at different speeds creating a very strange effect which I don't like.

    What I want is for the runSpeed variable to increase gradually so that it doesn't suddenly lurch and become faster.

    Is anyone able to explain to me the mistake I'm making?

    Thanks
    Simflare

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Still need help with this. I really can't figure out how to increase the global speed variable with floating numbers. Help anyone?

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleXNA Export Module
    DistantJ's Avatar
    Join Date
    Jan 2008
    Location
    Gloucester, UK
    Posts
    2,142
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Help with floating numbers

    I think Global Values all use integers, and if you supply a float they get rounded (though I'm not sure of the rules of how it is rounded).

    The best thing to do is set your runSpeed value to 10* what you want it to be, so if you wanted it to be 0.5 you'd set it to 5, or if you wanted it to be 1.5 you'd set it to 15, then when you want to use it, refer to runSpeed/10.

    For example:

    For 5 seconds: Add 1 to runSpeed
    Always: Set speed to runSpeed/10

    Just anywhere you want to use runSpeed, just refer to runSpeed/10.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you, it is helpful to know that global integers get rounded. I have managed to fix it now, thanks for your advice

  5. #5
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleXNA Export Module
    ProdigyX's Avatar
    Join Date
    Jan 2011
    Posts
    1,197
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    If you adding to the global value during runtime, it will accept become floating-point.

    You just cannot have a global value be floating during runtime.

  6. #6
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    Sphax's Avatar
    Join Date
    Jun 2006
    Location
    Paris, France
    Posts
    4,454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Global Values can be Float.

    They just don't accept Floats in the properties (at edit-time).

    However, Fusion works with Float in a strange manner. If the number is an integer, you must make it a float to get float result.

    For example: if Global value A (A) is 10 for each case:
    - A + 1 = 11
    - A / 3 = 3
    - A / 3.0 = 3.33333333

    That means, you must "cast" the global to float before making a calculation with an unknown value or an integer value to be sure to get a Float as result:

    For example, if Alterable Value B (B) is 3 and Global Value A (A) is 10 for each case:
    - A / B = 3
    - A * 1.0 / B = 3.33333333

    Then, you have a debugger to be sure that the result is what you expected.

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Sphax, that is very helpful I have just posted a new thread with a new issue related to this issue with floating numbers, but different. Sometimes the platforms wobble visually, forward and back slightly. If you have any extra advice on the subject, I'd appreciate it. Thanks

Similar Threads

  1. Random Numbers and expiring the result numbers.
    By Corlen in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 26th April 2013, 05:11 PM
  2. Generating random floating point numbers
    By Greasy in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 7th January 2012, 07:12 AM
  3. Random Numbers Greater then Random Numbers...
    By Hordolur in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 15th April 2009, 07:24 AM
  4. Floating point numbers don't work.
    By KittieRose in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 14th March 2007, 07:03 AM
  5. Floating Point Numbers
    By killacam in forum The Games Factory 2 - Technical Support
    Replies: 1
    Last Post: 5th October 2006, 07:37 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
  •