I can NOT figure this out.

Ok,
So I have constrained the actors self position to mouse touch for X and Y. That makes it so he follows my fingers as long as I'm touching him... So thats all good. But I only need him to follow for 50 pixels or so in whichever direction I press and drag him. Once he reaches that limit of 50 I want it to be like I have released my touch and now he freely falls whever he is at.


So think of it like this.
The app Move the Box.
You have a actor sitting on top of another actor. You can drag him either left,right,up or down but only for about 50 pixels then he free falls from where he is at! I need that movement and I am pulling my hair out trying to get this right.

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    edited February 2014
    wrap the constrain behaviors in a rule that says something like

    when self.position.X < centerpoint+50
    AND
    when self.positionX > centerpoint - 50

    constrain to mouse X & Y

    OTHERWISE

    fall down




    where centerpoint is where the blocks are located. You could have this be a static global attribute, or maybe a local (to the actor) self attribute that is updated when the game starts:

    change attribute self.centerpoint = self.positionX

  • change attribute self.centerpoint to self.positionX after all rules?
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    change attribute self.centerpoint to self.positionX after all rules?
    I usually put those sort of rules at the very top.

  • DUDE I LOVE YOU! This is the only thing that workd! It's awesome. Now one last thing. When He falls down, if he happens to land on another actor I want him to stop pretty much just land on the actor like he is a solid object
  • Yes and your right I put it on top, Thanks man
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    DUDE I LOVE YOU! This is the only thing that workd! It's awesome. Now one last thing. When He falls down, if he happens to land on another actor I want him to stop pretty much just land on the actor like he is a solid object
    you want to play around with the density/friction and restitution (bounciness) of both actors.

    I'd put restitution to 0, high density and high friction maybe?
Sign In or Register to comment.