How do I cancel a Move To behaviour?

ShaunEleryShaunElery Member, PRO Posts: 148
Say that point A and point B are on different sides of the screen. I used the Move To behaiviour to make my actor go towards point A, but say that half way there I change my mind and want him to turn around and go to B instead. How do I cancel the Move To pointA behaviour? Right now the actor will not change direction mid way but I need him to.

Thank you

Comments

  • carlblanchetcarlblanchet Member Posts: 755
    what you can do is use interpolate instead of move to since move to tends to glitch some times.
    and have an integer attribute, and if this attribute is 0 then set the actor to interpolate its self.position.x or y to point A and if the attribute is 1 set it to interpolate to point B.
  • SocksSocks London, UK.Member Posts: 12,822
    edited January 2013
    Here's quick demo:

    (click anywhere on the screen to change direction)

    http://www.mediafire.com/?al4pudjxajk6ja4
  • ChakkuChakku Member Posts: 1,513
    Or have the button actor, and it's graphic as a separate actor, and say

    Rule

    When game.turnaround is true,

    Change attribute B.position.x to A. position.x

    Change attribute B.position.y to A. position.y

    Since the graphics and functioning are separate actors, it won't look like the button moved.

    Hope this helps
    Chakku
  • SocksSocks London, UK.Member Posts: 12,822
    . . . . basically, there a ton of different ways to do this !
  • ShaunEleryShaunElery Member, PRO Posts: 148
    thanks
  • ericzingelerericzingeler Member Posts: 334
    edited January 2013
    A good way to do this using physics (interpolate and constrain are not physics) is have something like the following:

    4 Real Attributes:

    Current Target Position X
    Current Target Position Y
    Next Target Position X
    Next Target Position Y

    1st Rule (Any)

    If Current Target Position X not= Next Target Position X
    If Current Target Position Y not= Next Target Position Y

    Change Current Target Position X to Next Target Position X
    Change Current Target Position Y to Next Target Position Y

    2nd Rule (All)

    If Current Target Position X = Next Target Position X
    If Current Target Position Y = Next Target Position Y

    Move to Current Target Positions

    Edit Next Target Positions when you want to change direction
Sign In or Register to comment.