Dragging Question

Hi all,
I'm making a game where you drag letters to specific places to spell a word.

When the right letter reaches it's target I want to be able disengage the ability to drag the letter.

It works when you collide/overlap the target, but kinda sticks to the side of it. I can't seem to get it to stop in the middle of the target.

Any ideas much appreciated!

Answers

  • pipepipe Member Posts: 54
    edited June 2013
    [comment removed by moderator]
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited June 2013
    @pipe please don't "backseat moderate." If you feel there's a problem with a particular post or thread, please contact a moderator via private message.

    There's a more recent thread about this issue here: https://forums.gamesalad.com/discussion/57262/drag-and-drop-something-to-a-grid#latest.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    @tatiang glad to see the moderators are cracking down on some users who are spreading misinformation and clogging the forum with nonsense. Thank you!
  • Fal01Fal01 Member Posts: 460
    :-/
  • HopscotchHopscotch Member, PRO Posts: 2,782
    What you need to do is let the Letter "snap" to the center of the target and then disable the drag ability.

    If your Letter and/or Target is quite big and the "snap" makes too much of a jump upon colliding/overlapping, then you have at least two options:

    a) upon collide/overlap do a proximity calculation between Target and Letter before the "snap" happens. I.e. only "snap" when the center of the Letter is within 20pixels from the center of the Target.

    b) constrain a smaller actor to the center of the Letter, same with the Target. Then put the collide/overlap "snap" logic into these smaller actors.
Sign In or Register to comment.