Hi,
I was doing some experiments, and I can’t seem to figure out something.
speed = .9;
setInterval(followLeader, 40);
function followLeader() {
follower._x = speed * (follower._x - leader._x) + leader._x;
follower._y = speed * (follower._y - leader._y) + leader._y;
}
How would I make it so there’s a little bit of momentum with the follower?
The leader is actually a set destination where a user can determine with a click on the screen. Everything works beautifully. I just want to add a sort of cap to the turning of the follower so when it changes direction, it has to continue going the direction it was going previously, and “turn around” to go towards “leader”.
Like a car would drive basically.
Thanks
Proton