Constrain actor to another actor.

As_Of_LatteAs_Of_Latte Member, BASIC Posts: 343

Can I constrain one actors position to the edge of a different actor? If so, does anyone know how this can be done?

Hope this makes sense and I appreciate any help in advance :).

Comments

  • SummationSummation Member, PRO Posts: 476

    Sure, you just have to figure out where the edge is.
    I would constrain the edge of the actor to two game level attributes, x and y, and then constrain the follower actor to the game level attributes.

  • As_Of_LatteAs_Of_Latte Member, BASIC Posts: 343

    @Summation Nice, thank you! I'll give it a try right now.

  • SocksSocks London, UK.Member Posts: 12,822

    @As Of Latte said:
    Summation Nice, thank you! I'll give it a try right now.

    Also this might be useful too:

    http://forums.gamesalad.com/discussion/75220/fast-constrain-linkmachine-v2

  • As_Of_LatteAs_Of_Latte Member, BASIC Posts: 343

    @Socks Awesome! I was unaware of your past post (I should have done more research) but this is very helpful! Thanks you :)

  • noahbnoahb Member Posts: 8

    @Summation said:
    Sure, you just have to figure out where the edge is.

    No matter how big the actor is, the right edge of the actor is always:
    (self.position.x) + ((self.size.width)/2))

    an the left edge is:
    (self.position.x) - ((self.size.width)/2))

    This is a handy way of finding the edge because even if you change the size or position of the actor the game will calculate the x position of its edge for you.

  • SummationSummation Member, PRO Posts: 476

    @noahb said:
    No matter how big the actor is, the right edge of the actor is always:
    (self.position.x) + ((self.size.width)/2))

    an the left edge is:
    (self.position.x) - ((self.size.width)/2))

    This is a handy way of finding the edge because even if you change the size or position > of the actor the game will calculate the x position of its edge for you.

    Nice one, @noahb

Sign In or Register to comment.