User Tag List

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

Thread: Testing if an object is within a certain distance

  1. #1
    No Products Registered

    Join Date
    Aug 2007
    Location
    Uithoorn, the Netherlands
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Testing if an object is within a certain distance

    The title basically says it. I need to know this.

    I thought of an expression, but I can't use that because I can't directly enter it (i.e., there is no condition "if expression is true", as far as I know)

    Please. Help.

  2. #2
    No Products Registered

    Join Date
    Aug 2007
    Location
    Uithoorn, the Netherlands
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Testing if an object is within a certain distance

    Never mind, I found it.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)

    Join Date
    Sep 2007
    Posts
    242
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Testing if an object is within a certain distance

    I was just about to post a new topic about this. I need to know the same thing, so you figuring it out without telling anyone isn't helping me.

    What I'm trying to figure out is, how do I go about making an object change states when the player is within a certain number of pixels of that object?

    Any takers?

  4. #4
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    RickyRombo's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere between here and there
    Posts
    3,167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Testing if an object is within a certain distance

    Use the Advanced Direction Object. Test for Distance between points is equal or less than however much, do stuff you want to do.

  5. #5
    Clicker Multimedia Fusion 2

    Join Date
    Sep 2006
    Location
    Britain, South Coast
    Posts
    1,030
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Testing if an object is within a certain distance

    No need for advanced direction object, you can do this:

    ALWAYS
    --- Object: Set 'distance' to:

    sqr( (x("Object") - x("Target")) pow 2 + (y("Object") - y("Target")) pow 2)


    OBJECT: 'Distance' > 100
    --- (do something)


    Do it that way, and it'll work with object selection. If you don't want to use the formula, just replace it with the advanced direction object's expression instead.


    The formula's really easy once you know how it works, I'm working on an animation to explain it, but for now, I'll write a small article.

  6. #6
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Testing if an object is within a certain distance

    If you need to do lots of distance checks an extension will be faster though... At least it was in MMF1.5, haven't checked in MMF2.

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)

    Join Date
    Sep 2007
    Posts
    242
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Testing if an object is within a certain distance

    I tried useing that extension, as recommened, but I've run into a snag.

    I'm trying to make it so that when you are within a certain number of pixels of a certain floor tile, it springs out spikes.

    Instead what occurs is that when you get within a certain number of pixels of the floor tile, they ALL spring out spikes.

    Anyone run into this before?

    I'm using the Advanced direction object, and the code is as such.

    -->The distance between player and object is 50
    Then Change object's animation to (Spiked)

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)

    Join Date
    Sep 2007
    Posts
    242
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Testing if an object is within a certain distance

    I did get the forumla to work without the extension though. I'll go with that if it doens't cause slowdown.

  9. #9
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Testing if an object is within a certain distance

    The reason all spikes react is because all spikes get picked by that one event. Splitting it into 2 events as in Dines example will fix this.

  10. #10
    Clicker Multimedia Fusion 2

    Join Date
    Sep 2006
    Location
    Britain, South Coast
    Posts
    1,030
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Testing if an object is within a certain distance

    Well the article and example are both done, so if you ever wondered how the distance formula works, or want to see a couple of simple examples of stuff you can do with it, just mosey on to:

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

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Distance and Nearest Object
    By Hydra in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 13th February 2013, 01:06 AM
  2. Is a group of objects within a certain distance from another object?
    By Raphael in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 7th August 2012, 04:39 PM
  3. one of the same active object distance
    By bubba_damage in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 31st May 2009, 07:15 PM
  4. Distance Checking for Each Object Separately.
    By ogu in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 10th October 2008, 05:09 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
  •