Constrain with a delay?

GamersRejoiceGamersRejoice Member Posts: 817
edited November -1 in Working with GS (Mac)
Hey guys, I got a question for you. In my TOTB 3 entry Break For It! I have a shark that constrains to the y position of the turtle. However I would like for it to have a little bit of a delay instead of moving perfectly with the turtle. You can see what I mean here at about 2:50:

Comments

  • TheHooglerTheHoogler Member Posts: 102
    I'm still new to GS, so pardon me if this is a stupid answer (I tend to learn by making mistakes).

    Couldn't you just encase a change attribute in a timer? Have a timer change the y position every .5 sec (or whatever works). I would think it would work like a "delayed constrain".

    BTW, very nice graphics. The whole atmosphere just seems... right. Except your TOTB entry is actually inside a box. :P
  • GamersRejoiceGamersRejoice Member Posts: 817
    @ TheHoogler

    That would work however it makes the shark all jumpy rather than smooth...
  • entersimonentersimon Member, PRO Posts: 273
    One thing you can do is make the shark actor immovable and use interpolate to turtle's y with an ease out when self.position y > turtles y position + 10

    And then add another interpolate with an ease out for the reverse. Play with the variables to get the feel you're looking for.

    Then constrain another invisible actor to the shark's x,y to act as the collider.

    It's adding another actor, but since it's immovable and only using interpolate for y positioning, it's not resource heavy.

    I've been using this technique for the game I've been working on for the past few months and it's a nice effect.
  • GamersRejoiceGamersRejoice Member Posts: 817
    Thanks entersimon,

    I'll have to play around with that. It's a definite brain fart day. Thanks!
  • entersimonentersimon Member, PRO Posts: 273
    Anytime! It's better to let the brain fart sometimes than to try to hold it all in.

    If you find something nicer be sure to let me know. I've played around with quite a few different techniques but so far I haven't found anything that feels more natural than this.
  • TheHooglerTheHoogler Member Posts: 102
    @GamersRejoice

    Would you mind sharing how you made the turtle lurch forward, then return to its position? Did you use interpolate? Were you adjusting linear velocity, or linear position? (I'm guessing your background moves, not your turtle). Thanks :)
  • LumpAppsLumpApps Member Posts: 2,881
    Accelerate to might be a nice options. I used it in one of my proto's and it gives an actor a very smooth chase. (i am not at a computer now I'm not sure if I used a timer)

    Cheers,
    Ludwig
  • GamersRejoiceGamersRejoice Member Posts: 817
    @TheHoogler

    Sure, It was quite easy actually. All I did was change the X velocity to something like 300 then put a timer after 2 seconds (or something like that) Change velocity to 0 and interpolate back to inital X for 3 seconds.
  • TheHooglerTheHoogler Member Posts: 102
    Thanks!
  • LumpAppsLumpApps Member Posts: 2,881
    Just looked it up. I used "accelerate to".
    My player-actor flies left and right and this gives a nice delay when you turn around because the enemy needs some time to decelerate and accelerate into the opposite direction.

    You can use this but then only for the y axis.

    Hope this helps.
  • GamersRejoiceGamersRejoice Member Posts: 817
    LudwigHeijden said:
    Just looked it up. I used "accelerate to".
    My player-actor flies left and right and this gives a nice delay when you turn around because the enemy needs some time to decelerate and accelerate into the opposite direction.

    You can use this but then only for the y axis.

    Hope this helps.

    Thank you sir! I'll play around with that way too.
  • LumpAppsLumpApps Member Posts: 2,881
    Anytime ;)
Sign In or Register to comment.