Drag and Drop Issue with actor sticking together

cmw333cmw333 Member Posts: 76
edited November -1 in Working with GS (Mac)
I checked the forums before and found something 2 years ago. My issue is when I drag an actor over an other actor it sticks together. Joe from firemaplegames already answered this question but I really don't understand how to implement in my project.

This is what he wrote

"i would set a global boolean attribute called "isDragging" or something like that.
Leave it FALSE by default.

Only be able to pick up an object when isDragging is FALSE.

As soon as you pick up an object, set isDragging to TRUE.

As soon as you drop an object, set it back to FALSE."

If someone could please send a screen shot how to do this that would be great.

Also how can I upload my project to view in gamesalad. Im not ready to upload to the app store.

Comments

  • cmw333cmw333 Member Posts: 76
    Thanks for the quick reply tshirtbooth. I just tried it but it doesn't work. Just to clarify so I can be sure it is not something that I missed out.

    set up an Index attribute and named it "Drag"

    then I made 2 rules for the simple drag and drop

    rule
    when touch is pressed
    change attribute self.Drag = 1
    otherwise self.Drag = 0

    rule 2
    when attribute self.Drag = 1
    constrain self.position.x to mouse position.x
    constrain self.position.y to mouse position.y

    Then I made a .isDragging (boolean) in the game area
    followed by another .isDragging in the actor.

    Then I made 3 other rules

    Rule
    when touch is pressed
    change attribute self.isdragging to true

    Rule
    when touch is released
    change attribute self.isdragging to false

    rule
    when attribute game.isdragging = true
    constrain self.position.x to mouse position.x
    constrain self.position.y to mouse position.y

    I did the same for both actor actor and actor 2. So in total I had 5 rules. Is that correct.
  • cmw333cmw333 Member Posts: 76
    Hi again

    Thanks alot for your help but it is not exactly what I was after. I think alot of people have had a similar problem in the past but not been answered. The reason why I added the 2 rules was because I didn't realise the code did the same job as what you sent in the demo. The best example I can show you is a free app from the app store called "shape puzzle HD Free". If you can help that would be great.

    The game is an educational jigsaw puzzle. The pieces can overlap without sticking together.

    I really appreciate everyones help on this forum and don't want to rock the boat by sounding ungrateful.

    Chris
  • cmw333cmw333 Member Posts: 76
    The game is an educational jigsaw puzzle. The pieces can overlap without sticking together.
  • RHRH Member Posts: 1,079
    I haven't looked at that game but maybe this will help: http://gamesalad.com/ontheappstore/3279
  • cmw333cmw333 Member Posts: 76
    Your a genius. sorry for any confusion. I think alot o people have had a similar problem with this one. Thanks again.
  • cmw333cmw333 Member Posts: 76
    Thanks RH. I am away fir a few days but will check out your demo when I get back.

    Cheers

    Chris
Sign In or Register to comment.