How do I make an actor run away from another?

dimokdimok Member Posts: 16
edited November -1 in Working with GS (Mac)
Hi! Before I improvide my way out of it, I was wondering if there was a way to make one actor "run away" from another, as on opposite of (move to).
I think I saw something similair in templates where you drag and shoot an object (like angry birds) though I might be mistaken.
In any case, Thank you in advance!:)

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Improvising is a great way to learn GameSalad!

    Instead of using moveto, its probably easier to use move.

    To get an actor to move _toward_ something (like the mouse in the following case) use Move:

    Direction: vectorToAngle( game.Mouse.Position.X - self.Position.X , game.Mouse.Position.Y - self.Position.Y )

    To get an actor to run _away_ from something use Move:
    Direction: vectorToAngle( self.Position.X - game.Mouse.Position.X , self.Position.Y - game.Mouse.Position.Y )

    Of course, you would substitute in the other actor's positions where it now says mouse position.

    Hope this helps,
    RThurman
  • dimokdimok Member Posts: 16
    Thanks! I realized that it is much easier - you just set "mote to" behavour and set the movement speed negative :)
    -dimok
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    @ dimok -- That's a great solution! I'll try to remember that one too.
    RThurman
Sign In or Register to comment.