Help Please :- Common Snapping Distance

Ask a Question related to Macromedia Director Lingo, Design and Development.

  1. #1

    Default Help Please :- Common Snapping Distance

    Hi all,

    I have a lot of sprites on stage which represent magnets. All these sprites
    have the same height but different widths. I want to write a program in
    which when two sprites come close to each other at a specific distance they
    must snap to each other.
    Now my main problem is that since each sprite have different widths it is
    difficult to fix a single value for the distance within which they should
    snap to each other. Also it is also possible that any sprite can come close
    to another sprite from any side. So the script should check for the distance
    from any side. Please suggest some ways in which I can establish a common
    distance between the sprites which have different widths.

    Looking forward to suggestions. Thanks a lot.

    Regards,
    LW J


    Logic Writer Guest

  2. Similar Questions and Discussions

    1. Snapping
      hi I have a problem in my scripting in which i want to snap one model to the other. I have two model's sphere01 n sphere02. To move the model's i...
    2. tutorial file for snapping
      hi can some one plz help me with some tutorial file on snapping 3d objects in 3d world. william
    3. snap distance > pick distance impossible?
      In the General Preferences, I tried to set the value for the pick distance to 1, and the snap distance to 5, but after several tries (and thinking...
    4. snapping flash components together
      I'm piecing together all these flash components and they aren't connecting the only gaps we are trying to fix are: 1. between bottom of black...
    5. Need help snapping...Please!
      Hi guys, a buddy and I have been trying to figure this one out - maybe someone out there has either done this or seen something similar. We're...
  3. #2

    Default Re: Help Please :- Common Snapping Distance

    "Logic Writer" <logic_writer@rediffmail.com> wrote in message
    news:biae2b$6fk$1@forums.macromedia.com...
    >
    > I have a lot of sprites on stage which represent magnets. All these
    sprites
    > have the same height but different widths. I want to write a program in
    > which when two sprites come close to each other at a specific distance
    they
    > must snap to each other.
    The approximate alogorithm in pseudocode:

    if left edge of sprite > right edge of other sprite then
    if:
    sprites overlapping
    OR right edge of other sprite - left edge of sprite < snap range
    then
    snap
    end if
    else <do the same in reverse for other side>

    repeat for top & bottom as well as left & right. You can easily get the
    edges of the sprites by checking the .rect property instead of just .loc;
    you can also use .height, .width and loc together with the regpoint to get
    the same values.

    - Robert


    Robert Tweed Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139