User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: Accelerate to target

  1. #1
    Clicker Fusion 2.5iOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    904
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    Accelerate to target

    I have this formula for an object to decelerate as it nears its target:

    Pos( "Active" )+(Mouse-Pos( "Active" ))*0.1

    How do I reverse this so that it accelerates until it hits the target and then stops?

    Thanks!

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had to use a few actions, but I think it's the best way to do it...
    Attached files Attached files

  3. #3
    Clicker Fusion 2.5iOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    904
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    I was hoping not to use angles and distances. After a bit of looking around I found this:

    +key not pressed
    -->set dx,dy to xpos,ypos
    -->set t to 0.0001

    +key pressed
    --> set dx,dy to dx,dy+(t*(tarx,tary - dx,dy))
    --> add t to t (for exponential movement)

    +t > 1.0
    --> set t to 1.0


    Thanks anyway!

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    KLiK-iT's Avatar
    Join Date
    Sep 2011
    Location
    New Jersey
    Posts
    2,852
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Can you post the mfa of what you found?

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by KLiK-iT View Post
    Can you post the mfa of what you found?
    I second this. My solution seems far easier to use...There's no logical reason to say "I'm not using distance and angle" when they make the code cleaner and shorter. It's by no means complex code.

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    KLiK-iT's Avatar
    Join Date
    Sep 2011
    Location
    New Jersey
    Posts
    2,852
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I have to agree with you Eliyahu, it seems like a good solution. I'm not saying what you found SolarB, is not as good or better. Just would like to see both!

  7. #7
    Clicker Fusion 2.5iOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    904
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Example:

    acceltest.mfa

    I think it's a form of interpolation. The reason I don't want to use distances and angles is because my program is already under load and these add extra strain, so I'm told.

    As for cleaner and shorter, well, you be the judge.

    Anyway I like your method Eliyahu and in any other situation I would probably use it.

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What a weird solution...lol. But if it works, that's fine! It's all about getting it into your application easily.

    As far as slowing down your program, there will be absolutely no noticeable difference between mine and yours. These calculations happen so quickly in comparison to the other things your application has to handle.
    What slows MMF2 is when you have excessive graphics, fastloops going for thousands of loops and performing on multiple objects, and just plain lots of objects.
    Mathematical operations are essentially nothing.

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    KLiK-iT's Avatar
    Join Date
    Sep 2011
    Location
    New Jersey
    Posts
    2,852
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Both are good examples, but how would you slow down the acceleration in yours SolarB. It seems to me that when you click, the object moves pretty fast toward the mouse pointer and I can barley see the increase in acceleration.

  10. #10
    Clicker Fusion 2.5iOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    904
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Eliyahu: Yes I have > 500 objects so each of them doing trig and setting angles (especially setting angles) does slow it down a little (need precious FPS).

    KliK-It: Just set t to t*0.whatever

Page 1 of 2 1 2 LastLast

Similar Threads

  1. X += (target - X) * .1
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 25
    Last Post: 10th June 2012, 11:54 AM
  2. Car movement: accelerate with button
    By Leander in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 22nd July 2008, 11:23 PM
  3. how to to accelerate object?
    By piki in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 17th February 2008, 01:16 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
  •