GameSalad

Constrain one actor to another

bkhoward2001bkhoward2001 Posts: 74Member, PRO

I have a situation where I need to spawn an actor that will travel across the screen; however, I need to spawn another actor which stays right below the first actor....Any ideas how I would do this? thanks.

Comments

  • tatiangtatiang Posts: 11,215Member, Sous Chef, PRO, Senior Sous-Chef
    edited March 31

    There are many tutorials for this if you Google contrain actors gamesalad. But here's the basic method:

    In the spawner actor:
    Constrain attribute game.leaderX to self.Position.X
    Constrain attribute game.leaderY to self.Position.Y
    Spawn actor [follower]

    In the spawned actor:
    Constrain attribute self.Position.X to game.leaderX
    Constrain attribute self.Position.Y to game.leaderY-75

    Notes:
    Game.leaderX and game.leaderY need to be real attributes. Obviously, you can use any value in place of 75. If the spawner actor always has the same Y position, you should use Change Attribute self.Position.Y to game.leaderY-75 instead within the spawned actor. It's best not to have too many constrain behaviors in use.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • BunkerBunker Posts: 36Member, PRO

    you should check out that Guru's vids for beginners - helped me out a lot at first!

    thanks guru!

    https://www.youtube.com/user/dsouza41

  • bkhoward2001bkhoward2001 Posts: 74Member, PRO

    Thank you... Will try.

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

    @bkhoward2001 said:
    Thank you... Will try.

    This might be overkill, but could be useful.

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

Sign In or Register to comment.