Actor follow actor

illusionillusion Member Posts: 4
edited November -1 in Working with GS (Mac)
Hi,

I'm not quite sure on how to get an actor to follow another actor.. so for example say I have an actor (player) and a shopping trolley.. now the player walks around as normal, but soon as he bumps into the trolley it sticks to him until he pushes a button to release it.
How would I go about doing something like this?

Thanks

Illusion

Comments

  • KamazarKamazar Member Posts: 287
    When player collides with shopping cart:
    Follow = true

    If Follow = true
    Constrain Cart.Position.X to Player.Position.X + 50 (or whatever offset you want to use, otherwise the cart will be on top of the player.
    Constrain Cart.Position.Y to Plaster.Position.Y + 50

    If Button is pressed
    Follow = False

    Simple as pie!
  • jstrahanjstrahan Member Posts: 498
    Make two attributes one x and one y
    The constrain player x, y to them
    Make an attribute Boolean push
    On the cart make rule on cart that if collide if collide with play change attribute push to true otherwise false
    Another rule if push true constrain cart x,y to attribute x,y plus any offsets you need for correct position
    The on player make rule if push button change oust to false
  • jstrahanjstrahan Member Posts: 498
    Is that apple or chocolate pie or maybe lemon
  • illusionillusion Member Posts: 4
    awesome thank you :)

    Illusion
Sign In or Register to comment.