Follow actor with swinging effect

rftimoteorftimoteo Member Posts: 9
edited May 2014 in Working with GS (Mac)

Hello,

I have two actors who may be called the leader and the follower.

What I want to do is to make the follower to chase the leader. Here's an example:

The leader is constrained to mouse position.

If the leader is going straight up I want to have the follower on its tail, and vice-versa;

If the leader is going to the right I want to have the follower on its left side, and vice-versa.

If the leader is going to an angle of 135º I want to have the follower at 315º... That is always symmetric. And at a distance of about 50 pixels.

However I have no idea how to achieve this.

Can I have any enlightment, please?

Thank you in advance. Have a nice day.

Comments

  • joshiwujoshiwu Member Posts: 207

    game slad allows you to get Angles(rotation) and make it -negative, that will get you your facing backwards. as far as the follower being in place, that should just kind of happen as an effect of following.

    I believe you can use magnitude to determine the exact distance of the leader from the followers, lets call it dist.
    say if "dist" is greater than 50 move backwards
    else if dist is less than OR equal to! 50 move forward

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

    @rftimoteo said:

    Here's one way, not sure if it's quite what you want, but it might give you some ideas.

    Link: https://www.mediafire.com/?b4yjxo6d7pufx8b

    . . .

  • rftimoteorftimoteo Member Posts: 9
    edited May 2014

    @Socks said:
    . . .

    It was exactly what I was looking for. I just need to play around with physics but that's it. I'm so grateful.

    Have a nice weekend.

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2014

    @rftimoteo said:
    It was exactly what I was looking for. I just need to play around with physics but that's it. I'm so grateful.

    Glad it works for you, it's a bit rough but I'm sure you could tune it up for your needs.

    One thing that might be useful would be to put a change attribute behaviour in the 'mouse button' down rule for each actor that changes [self.physcis.drag] to 0 - and then in the otherwise section put another change attribute behaviour that says change [self.physcis.drag] to 5000 (or whatever value you want).

    This means that the drag is loosened up when the mouse is down (when you want to drag the actor around) - and as soon as you let go the drag jumps back up to a high value so the actors grind to a halt rather than zooming off.

    You can also do the same for [self.physcis.AngularDrag] to stop them spinning around - change it to 0 when the mouse is down and have it jump back up to a really high value when you let go.

  • lewisonelewisone Member Posts: 48

    Jesh, Socks is a GS Pimp for sure.

    -LewisOne (My Website, FB, Twitter, IG, YT)

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

    @lewisone said:
    Jesh, Socks is a GS Pimp for sure.

    Is there a badge for that ?

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

    @Hopscotch said:
    Socks, no, but if you keep it up I have to draw something again -.-

    :o :p

    (these new emoticons are rubbish)

Sign In or Register to comment.