I want bunch of circles to follow the player while keeping a distance apart. So far I have this:

local p = {

local last={x=p.x,y=p.y}
for l in all(p.life) do
  l.x = lerp(last.x,l.x,0.5)
  l.y = lerp(last.y,l.y,0.5)

But this makes it so the circles collapse into each other and the player. I want the circles to have a distance between themselves and the player.

arythmia follow life

I've also tried this:

  l.x = lerp(last.x*0.8,l.x,0.5)

This leaves a distance as I want but the trail is always on the upper left, barely following player.

I want the trail to stay always behind the player.

Probably I can achieve this by stop following if the distance is less than threshold.


I did it by adding a condition before modifying the position of the trail:

if vdist(last,l) < 10 then
  // adjust position

it works now.

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.