GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

constrain actor to another actor

bertkromabertkroma Posts: 22Member, PRO
edited February 2012 in Miscellaneous
I've recently come over to GS from Construct2, and was wondering if there is a way to constrain one actor to a different actor?

Comments

  • HappyKat78HappyKat78 Posts: 173Member, BASIC
    Yes, there's a specific constrain behavior. I suggest starting out looking at the cookbook, watching some video tutorials and searching the forums. you'll easily find answers to things like this. :-)
  • gyroscopegyroscope I am here.Posts: 6,577Member, Sous Chef, PRO
    edited February 2012
    Hi @bertkroma, welcome to GS. :-)

    One of the behaviours in GSC is the contain behaviour, that'll do what you want.

    Edit: typing same time as @HappyKat78

    ----------------------------------------------------------------------------
    iPad app: End of the Earth –•– http://davidgriffinapps.co.uk/
    ----------------------------------------------------------------------------

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • SlickZeroSlickZero Houston, TexasPosts: 2,870Member, Sous Chef
    These 2 videos should help you out.



    I have no friends. I'm a loser that makes video games all day. Will you be my friend?

  • bertkromabertkroma Posts: 22Member, PRO
    Thanks Gyroscope, but I tried that and it doesn't follow the controller. I must be doing something wrong. Here is what I'm doing:
    paddle1=actor to be constrained
    controller1=actor to be constrained to
    on the paddle1 I added Constrain Attribute and in the behavior I set the expression to self.position.x to controller1.position.x

    also the controller1 didn't show up in the paddle1 expression editor so I typed it in manually, does it need to be added to some sort of global area?
  • bertkromabertkroma Posts: 22Member, PRO
    Thank you Slickzero. The videos cleared it up for me. I remember watching these in october before I started with Construct2. It's been awhile. I was missing the add attribute step.
This discussion has been closed.