User Tag List

Page 2 of 2 FirstFirst 1 2
Results 11 to 13 of 13

Thread: Problem with decimals and ini file

  1. #11
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,773
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Q: You have set up an active with four directions (0, 8, 16, 24) each with an animation (loops two times). Then you put some buttons that can add and subtract values to the animation index and direction.


    You would expect this to make the object turn 90 degrees each time you click a button, but it only works one time. You have also set a counter to display the animation direction, but it does not work.
    Explanation:
    The two directions are the "animation direction" (what is displayed) and the "movement direction" (what is stored and used for movement calculations). The problem is that you assume Dir() retrieves the former, where as it actually retrieves the latter.


    This mistake is easily made because the "Get Direction value" expression was accidentally put under the Animation sub-menu instead of the Movement sub-menu. There is no way to retrieve the current animation direction because it is not stored anywhere (it is usually determined automatically, derived from the movement direction and available animation directions).


    Imagine you have an active object with bouncing ball movement. This object has four animation directions set: Up, Down, Left and Right. In the event editor you set the object's movement direction to be right and up a little (AKA a direction of 1 in MMF2's directional system).


    While the object is moving to the right, an dup a little, its animation direction will be as if it were going right. However, if you use Dir("active") then it will give the movement direction of 1 and not the Animation Direction of 0.


    If you set the animation direction through events based on the movement direction, it will not change the movement direction and the next time you try to move based on on DIR)"active") it will give the same result because the movement direction has not changed.


    If, instead of relying on the movement direction, you stored the animation direction in the object's alterable value, then it would work as you expect. Instead of:
    Set animation direction to movement direction + B


    You would have:
    Add 8 to alterable value A of object
    Set animation direction to Alterable value A


    A further complication may arise. There are angles which are distinct from directions.

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  2. #12
    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)
    Ahh Marv is right,
    you are probably changing "animation direction"
    while you should change "direction"

    so for your objects not "change animation direction"
    but "set direction"
    the animation direction should change anyway
    but then retrieving animation direction value should work fine
    (crossing fingers )

  3. #13
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    944
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thanks everybody for all the effort in trying to figure this out.
    I've been at it this whole time and found a workaround that does work but I will for sure remember the correct way to do it next time.

    The workaround is: When you equip the gear I set that animation direction value to a global value as well. And THAT'S the value that I save in the ini, and load back.
    Lot of extra work for all the stuff but as long as it's done now I'm happy.

Page 2 of 2 FirstFirst 1 2

Similar Threads

  1. Problem with decimals in Equation
    By Basseman in forum Fusion 2.5
    Replies: 3
    Last Post: 30th April 2016, 02:13 PM
  2. Problem with Division/Percentage and Decimals
    By Conno in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 29th September 2015, 10:33 PM
  3. A problem with math throwing out decimals
    By kainminter in forum Fusion 2.5
    Replies: 4
    Last Post: 5th June 2015, 02:46 PM
  4. Problem opening a HTML file with a flash file
    By liliaks in forum SWF/Flash Export Module Version 2.0
    Replies: 2
    Last Post: 15th January 2012, 10:26 AM
  5. Problem setting a Global Variable to use decimals
    By RGBreality in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 16th February 2011, 06:29 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
  •