User Tag List

Results 1 to 3 of 3

Thread: How do you get the direction of an active object in comparison to another?

  1. #1
    No Products Registered

    Join Date
    Jan 2016
    Location
    Adelaide
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do you get the direction of an active object in comparison to another?

    Whenever I had multiple enemies, using the "look at (player) and start moving" system caused the enemies to overlap and eventually just do the same thing until they looked like they were one sprite.

    To circumvent this I am attempting to give them their own movement system. However, I do not know how to get the "direction" of their target, to make them move towards it?
    Due to the nature of Fusion, I cannot store the X and Y values of the objects and square root them under a hypotenuse variable, which is what I would do in a language such as C++. This makes it very difficult.

    Has anyone done something similar that they would be willing to share?

  2. #2
    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)
    Due to the nature of Fusion, I cannot store the X and Y values of the objects and square root them under a hypotenuse variable, which is what I would do in a language such as C++.
    You can definitely do that in Fusion, using alterable / global values as you would use variables in any other language.

    From what you describe, you seem to need the "angle" (direction) towards an object?

    You can use builtin "OAngle" function (under the object menu "Position - Angle of a vector" in the expression editor)
    or calculate that using Atan2 function: ATan2(Y1 - Y2, X2 - X1) --> this will also give you a floating point value, differently from the above.

    Once you got the angle, you can retrieve direction (angle /11.25)
    or you can code your own custom movement to move toward direction

  3. #3
    Clicker Multimedia Fusion 2 DeveloperiOS 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)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "How do you get the direction of an active object in comparison to another?"

    'Advanced Direction Object' has a function that gives you this ( along with alot of usefull functions for AI, like rotation towards another Object ).
    It can give you DirectionDifference between 2 directions ( regular or the absolute difference ).

    Juts make sure to set teh ADO parameter ( by doubble clicking the ADO ) to the directional system you are working in ( if working with the 32 dir system set it to 32, if working with the 360 degree system set it to 360 ).
    Surely possible to do it without the use of ADO, but ADO is mint.

Similar Threads

  1. Direction of active not responding correctly
    By Swiff in forum Fusion 2.5
    Replies: 7
    Last Post: 24th March 2015, 04:53 AM
  2. How to set active to face direction of touch
    By jay73 in forum Android Export Module 2.5
    Replies: 3
    Last Post: 2nd August 2014, 08:42 PM
  3. Active Object Direction Help...
    By Jusfury in forum Fusion 2.5
    Replies: 2
    Last Post: 28th July 2014, 12:56 AM
  4. Rotating & Look in Direction (Active Picture)
    By GabSt in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 14th July 2008, 07:20 PM
  5. Changing active object direction (???)
    By JohnC in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 19th January 2008, 11:58 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
  •