1 Reply Latest reply on Mar 29, 2007 5:36 PM by Newsgroup_User

    sprite constraint problem

    sarahbarber Level 1
      I would really like to know what Im doing wrong - I am trying to make a game for a uni assignment where you put shapes onto other shapes - kind of like a jigsaw - have used the script: sprite(a) . constraint
      the constraint of sprite b - but I can't work out why 'a' wont stick to 'b' please help!
        • 1. Re: sprite constraint problem
          Level 7
          I think the constraint function only works with sprites assigned the
          "moveable" property. Any more sophisticated sprite manipulation, like
          changing the loc with lingo would require you to 'clip' the position in
          your code.

          some rect functions might help...

          Here's an (untested) example using the rect of sprite 2 to constrain the
          regpoint of sprite 3

          on mouseDown
          repeat while stillDown()
          H = min(sprite(2).right(max (sprite(2).left, mouseH())
          V = min(sprite(2).bottom(max (sprite(2).top, mouseV())
          sprite(3).loc = point(H, V)
          end repeat