User Tag List

Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 32

Thread: Distance between objects

  1. #1
    No Products Registered

    Join Date
    Mar 2008
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Distance between objects

    How do I set a counter to the value of the distance in pixels from one object to another? Basically, if an object is 37 pixels away from another object, I want a counter to be set to the value "37".

  2. #2
    Clicker Fusion 2.5 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Location
    Turku, Finland
    Posts
    1,023
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Distance between objects

    Use the Advanced Direction Object, and do
    "Always" -> "set counter to direction between Player 1 and Player 2".

  3. #3
    No Products Registered

    Join Date
    Mar 2008
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Distance between objects

    Okay, I can't find where I can set direction between Player 1 and Player 2. Also, my distance isn't for the two players, it is for two different objects. What I am trying to do is figure out the distance between the two objects, and then no matter where the first object moves, the second object will move accordingly so that it stays the same distance away from the first object.

  4. #4
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Distance between objects

    I think the standard 'distance' formula goes something like:

    Sqr(((X( "Object A" )-X( "Object B" )) pow 2)+((Y( "Object A" )-Y( "Object B" )) pow 2))

    Just set your counter to this.

  5. #5
    No Products Registered

    Join Date
    Feb 2007
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Distance between objects

    This is easily done with the advanced direction object as said already, if you'd read it's docs or do a search on the forums you'd probably turn up a lot of examples too.

  6. #6
    Clicker Fusion 2.5 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Location
    Turku, Finland
    Posts
    1,023
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Distance between objects

    Being such a simple task, I made you and example here.

  7. #7
    No Products Registered

    Join Date
    Dec 2006
    Posts
    1,332
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Distance between objects

    There is a couple objects that can do this, mainly Advanced direction Object and the clickteam movement controller, but as Nifflas already said, you can simply use the distance formula:
    Sqr((x2-x1)^2+(y2-y1)^2)

  8. #8
    No Products Registered

    Join Date
    Mar 2008
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Distance between objects

    All of that worked, however, I could not figure out how to make the second object stay perportional to the first. What I eventually did was to make two counters and have one set to the x distance between the objects and I had the other set to the y distance between the objects. Then I made an event to set the second objects x and y postions to the first objects x and y postions minus the counter values. Thanks for all of your help!

  9. #9
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Distance between objects

    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=82293#Post82293

    A simple example of keeping object near each other.

  10. #10
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Distance between objects

    Quote Originally Posted by MrMan
    This is easily done with the advanced direction object as said already, if you'd read it's docs or do a search on the forums you'd probably turn up a lot of examples too.
    Yeah, but never add another extension to your project when a simple expression can perform the very same task. With each added extension comes a potential incompatibility issue (some doesn't work with DEP, some rely on external DLL's, some crashes on some machines). To me, adding an extension is a last way out when there's no way to achieve the same result using the built in functionality of MMF2.

Page 1 of 4 1 2 3 ... LastLast

Similar Threads

  1. Keep distance between two+ objects
    By iOSC in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 30th September 2013, 01:55 PM
  2. Distance between two objects
    By Panchos in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 15th November 2012, 07:47 PM
  3. Distance between 2 objects
    By qenio in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 26th June 2012, 09:12 AM
  4. Y distance between objects?
    By PandaExplosion in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 16th April 2010, 02:56 AM
  5. Detecting the distance between two same objects?
    By BrandonC in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 26th November 2007, 06:01 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
  •