User Tag List

Results 1 to 10 of 10

Thread: Storing Decimal Numbers as Alterable Values

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleSWF Export Module

    Join Date
    Sep 2006
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Storing Decimal Numbers as Alterable Values

    I'm trying to make a platform engine using the Move Safely 2 Object and modular gravity. I got the MS2O to work (stupid mistake, easily fixed), but the modular gravity is getting hiccups with decimal values.

    I have 2 counters that deal with the gravity data: direction and acceleration. The former is set to 270 and the latter is set to 2. I have it this way so that I can change it on the fly just by changing counters in the game.

    Anyways, so the way the platform engine is setup is that I have 4 alterable values: X and Y Positions and X and Y Velocities. The Velocities are changed using trigonometry on the gravity and strength. The Positions are changed using the X and Y speeds. And the Position values are distinct from the Coordinate values because I want to deal with them in small increments - I just set the X and Y Coordinates to the X and Y Position value.

    For example: the Coordinates of my Hero object can be at 400, but the Position value should be more accurate keeping track of partial pixels.

    But this is not the case. The directions break down into the 8 cardinal directions even if the angle is something like 20 degrees. I'm confused as to how decimals are stored in Fusion, and I'm convinced that this is part of my problem. If anyone can help, that'd be great. Thanks.

  2. #2
    No Products Registered

    Join Date
    Aug 2006
    Posts
    984
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Storing Decimal Numbers as Alterable Values

    Decimals in AV's only work if you use "Set Alterable value"

    You might also have to force MMF into using decimals (like using EXPRESSION * 1.0), if you aren't using trig functions.

  3. #3
    No Products Registered

    Join Date
    Jul 2006
    Location
    Texas
    Posts
    1,225
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Storing Decimal Numbers as Alterable Values

    Due to the way integers are used more often than decimals in MMF2, normally MMF2 rounds it. To get it to stop rounding, find the first part of the exression it will evaluate and insert x 1.00 in next to it. I think this should work.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleSWF Export Module

    Join Date
    Sep 2006
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Storing Decimal Numbers as Alterable Values

    It's still not working. I made sure everytime I modified an alterable value I used set and everything is multipled by a nice big 1.0 in front.

  5. #5
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleSWF Export Module

    Join Date
    Jun 2006
    Location
    Merseyside, UK
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Storing Decimal Numbers as Alterable Values

    Try setting the initial alterable value in the frame editor (if possible) to 0.0

  6. #6
    No Products Registered

    Join Date
    Jun 2006
    Location
    Land of raging rockets
    Posts
    1,231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Storing Decimal Numbers as Alterable Values

    That never worked for me.

    Just make sure that EVERYTIME and at least once, you "set" the value of such a variable, it contains * 1.0 or + 0.0
    If at some other point you set it to a value not containing a floating point value, it will return to rounding stuff.

  7. #7
    No Products Registered

    Join Date
    Jul 2006
    Location
    Umeå, Sweden
    Posts
    1,090
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Storing Decimal Numbers as Alterable Values

    A cheap method which I used a lot in MMF1.5 is to simply multiply it by 1000 (= 3 decimals) then when you retrieve the value, divide by 1000.... so instead of adding 0.1 you add 100.. get it??... It's simple and cheap but works!

  8. #8
    No Products Registered

    Join Date
    Jun 2006
    Location
    Land of raging rockets
    Posts
    1,231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Storing Decimal Numbers as Alterable Values

    Yeah I used to do that too. But I now believe that you don't save any or much performance in the end. Plus you have to remember what "scale" you are using. Oh well, guess it's a matter of taste.

  9. #9
    No Products Registered

    Join Date
    Jul 2006
    Location
    Umeå, Sweden
    Posts
    1,090
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Storing Decimal Numbers as Alterable Values

    Yeah... I don't think it's any faster, just a work around for the lack of decimal support in 1.5.. I usually name a global value to "scale" and use that... much simpler than remembering ^^

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleSWF Export Module

    Join Date
    Sep 2006
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Storing Decimal Numbers as Alterable Values

    The *1.0 doesn't work nor does the +0.0. Would anyone look at my file if I uploaded it to the upload forum?

Similar Threads

  1. Decimal numbers in Alterable Values?
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 1st January 2012, 04:05 PM
  2. I have a problem with decimal numbers
    By daniele in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 9th February 2009, 11:35 PM
  3. question about decimal numbers
    By Attus in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 16th October 2008, 07:43 AM
  4. Decimal numbers
    By Muz in forum Multimedia Fusion 2 - Technical Support
    Replies: 13
    Last Post: 25th February 2008, 04:58 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
  •