Drag & Drop Constrain

loressaloressa Member Posts: 11
edited November -1 in Working with GS (Mac)
Hi folks,

I have been making an actor drag n drop, then when it collides with another object, it constrains attribute so it sticks to that other object, and then you can pull it off and replace to original position. The problem with this technique is that they seem to pull together even when 1/2 and inch apart. How do I make them stick to only a small area within the other object?

Comments

  • loressaloressa Member Posts: 11
    To explain further, if you place one object over another, it snaps to the origin, but if the objects are large, then the snap is large too, and hard to drag the object off the other.

    The Game Attributes are real - posX and posY

    Actor "ball" has code:
    Constrain Attribute: game.posX To: self.Position.X
    Constrain Attribute: game.posY To: self.Position.Y

    Code inside draggable "bat"
    When the Actor receives event-overlaps or collides-with actor of type-"ball"
    Constrain Attribute: self.Position.X To: game.posX
    Constrain Attribute: self.Position.Y To: game.posY
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    Hey Loressa

    Here you go:

    http://instantmashgames.com/files/Shapes.gameproj.zip

    This should help you
    Ace
  • loressaloressa Member Posts: 11
    Thanks Ace!
Sign In or Register to comment.