Touch actors sticking help

FirstDanFirstDan Member Posts: 208
edited October 2012 in Working with GS (Mac)
Hi all

I have 4 actors that you can touch to move around. I am having an issue that when I drag an actor on top of another touch actor it sticks and moves both when touch is pressed.

I have looked at TSB tutorials on overlapping but non have worked as i am dynamically spawning these actors, where TSB is setting by unlocking the actors.

These actors must stay movable to false, can anyone help?

thanks troops

Dan

Coming Soon - My First Game :)



Comments

  • MantoManto Member Posts: 796
    You could make a global attribute ("dragging") and a self attribute ("touched") for the actor, which will be dragged

    Then make these rules in the actor:

    Rule 1
    If touch pressed and dragging is false
    Change self.touched to true
    Change dragging to true
    Otherwise
    Change self.touched to false

    Rule 2
    If self.touched is true
    Constrain attribute self.x to mouse.x
    Constrain attribute self.y to mouse.y

    Rule 3
    If touch count is 0
    Change dragging to false
  • FirstDanFirstDan Member Posts: 208
    @Manto1 - thanks for the reply - can i ask what touch count 0? in rule 3
  • FirstDanFirstDan Member Posts: 208
    @manto1 - thanks u have solved my problem, im ever so grateful!!
  • MantoManto Member Posts: 796
    You're welcome! :)
Sign In or Register to comment.