User Tag List

Results 1 to 8 of 8

Thread: How to get X+Y distance?

  1. #1
    Clicker Fusion 2.5 Mac

    Join Date
    Dec 2008
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to get X+Y distance?

    I have a problem here, I want to get the ABS of x+y, but I can only stick to one of then...

    In a zelda-like game I would need both distances as one value, how can I do that?

    ---

    As an example, if I have lots of dots on screen, and I set the scale posion to the dots in relation to the mouse pointer, instead of getting a cool water effect I got some sort of horizontal/ vertical effect, because I can only stick to abs Y or abs X, and not a general distance value.

  2. #2
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to get X+Y distance?

    sqrt(x pow 2 + y pow 2)

    i.e. square root of (x▓ + y▓)

    EDIT: Also you can do abs(x+y), I don't see why you say you can only do abs of x or y and not both. It won't get you a circle though, you need the formula above for that.

  3. #3
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: How to get X+Y distance?

    I'm not entirely sure what you want.

    The euclidean distance between two points- the shortest distance between them, is given as sqrt(x pow 2 + y pow 2) as Dynasoft gave. However, if what you're asking for is the "Manhattan Distance", that is, the distance when you can only travel vertically or horizontally, that is given as:

    Max(Abs(>X Point 1<->X Point 2<), Abs(>Y Point 1<->Y Point 2<))

    The distance if you can only travel horizontally, vertically or diagonally, is given as:

    Abs(>X Point 1<->X Point 2<)+Abs(>Y Point 1<->Y Point 2<)
    (the chebyshev distance)

    Thank sketchy's snippet editor for those.

  4. #4
    No Products Registered

    Join Date
    Aug 2010
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to get X+Y distance?

    >> Thank sketchy's snippet editor for those.

    I have done a search for this with 200 results but most highlighting 'editor.' Do you know of a link to this? This would be very useful if it contains more examples as above.

  5. #5
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: How to get X+Y distance?

    Sketchy's generally the guy to go to for his stuff!
    http://create-games.com/download.asp?id=8227


    Its incredibly handy if you use those formulas a lot!

  6. #6
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to get X+Y distance?

    This one works too!

    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=114615#Post1146 15

  7. #7
    No Products Registered

    Join Date
    Aug 2010
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to get X+Y distance?

    Thanks for the links. That is so cool. I do enjoy the possibilities of tweaking MMF with the math - sometimes to the point of distraction

    I wonder if there is/are any snippet repository beyond what comes with the download. I was working on a parabola that would probably work into this scheme and would be happy to post it ?somewhere?

    thanks again - ak

  8. #8
    Clicker Fusion 2.5 Mac

    Join Date
    Dec 2008
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to get X+Y distance?

    Snippet is a life saver, thanks A LOT for who did this!

Similar Threads

  1. Distance
    By ad in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 28th April 2012, 04:24 PM
  2. Distance Meter
    By videogiochi in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 6th July 2010, 09:02 AM
  3. Distance Formula
    By Dines in forum Articles
    Replies: 15
    Last Post: 29th May 2008, 11:33 AM
  4. Distance between objects
    By im2famous4u in forum Multimedia Fusion 2 - Technical Support
    Replies: 31
    Last Post: 18th March 2008, 10:58 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
  •