Professional Web Applications Themes

Snap Sprites to Nearest Grid Space - Macromedia Director Lingo

Hi, I have this problem which I need the solution to ASAP. I have started developing a program which requires snapping of sprites to nearest grid space. I tried the "snap to grid" property and behaviour but it only snaps my sprite to anywhere along the grid (i.e. grid line, grid space). I need to know the lingo script to snap the sprites to the nearest grid space itself and not on the lines or anywhere within the grid as it so likes. Please help!!! Thanks....

  1. #1

    Default Snap Sprites to Nearest Grid Space

    Hi,

    I have this problem which I need the solution to ASAP.

    I have started developing a program which requires snapping of sprites to nearest grid space. I tried the "snap to grid" property and behaviour but it only snaps my sprite to anywhere along the grid (i.e. grid line, grid space).

    I need to know the lingo script to snap the sprites to the nearest grid space itself and not on the lines or anywhere within the grid as it so likes.

    Please help!!!

    Thanks.


    starrize webforumsuser@macromedia.com Guest

  2. #2

    Default Re: Snap Sprites to Nearest Grid Space

    Hi!
    try this its not perfect but....
    put it in a frame script.
    make sprite 1 moveable and drag it around.
    its a start anyway...

    on exitFrame me


    GridSize = 32


    --if the mousedown = false then

    In_GridX = (Sprite(1).locH/ GridSize)
    In_GridY = (Sprite(1).locV/ GridSize)

    XX = In_GridX * GridSize
    YY = In_GridY * GridSize

    Sprite(1).loc = point(XX, YY)

    --end if



    go to the frame
    end

    /M



    MosseMilk webforumsuser@macromedia.com Guest

  3. #3

    Default Re: Snap Sprites to Nearest Grid Space

    Thanks. I tried.

    However, I feel that specifying the grid location will make the sprite fall into its intended position better.

    How do I go about specifying the grid location?

    Any help will be greatly appreciated!



    starrize webforumsuser@macromedia.com Guest

Similar Threads

  1. Flex Designer Snap Grid
    By ctzn99 in forum Macromedia Flex General Discussion
    Replies: 2
    Last Post: May 27th, 06:09 AM
  2. Snap to Grid feature
    By George_Morten@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 4
    Last Post: November 25th, 05:18 PM
  3. FH doesn't reliably snap to grid or guides
    By fhdave in forum Macromedia Freehand
    Replies: 3
    Last Post: May 31st, 01:23 PM
  4. Lines and Polygons "Snap To" nearest text box
    By J._Michael_Gibbs@adobeforums.com in forum Adobe Acrobat Windows
    Replies: 0
    Last Post: May 5th, 04:11 PM
  5. snap to grid
    By kenarchi webforumsuser@macromedia.com in forum Macromedia Director 3D
    Replies: 0
    Last Post: August 29th, 06:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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