Slowing down trails while keeping them where they are?

Basically, this is a Flash game (as in the superhero), and I’m having some problems with the lightning trail. When the player runs fast, a trail appears behind them, and when they slow down the time, the trail doesn’t disappear but slows down too. I can make the trail’s lifetime longer every time the time slows down, but the already generated trail won’t slow down and thus making the trail smaller for a few seconds (here’s a video from another game that shows it).

I tried fixing this by always having 2 different trails, one with a long and one with a shorter lifetime, and then set the transparency to enable or disable them. And now slowing down the time while not running fast shows trails that are supposed to be over (video). Do you know any solution to this?

Sorry, I’ve never made anything similar to what the game is or like what you’ve done.

But the way I think of is just:
In your running script / have a running variable for each player that is a boolean
so like every time when the running variable is set to true, the lifetime of the trail of that player is switched to a longer time, but when the running variable is set to false(When the player stops running), the lifetime will be switched back to the original value.

Like maybe something like this:
(Consider run is the variable name, and the trail name is RunningTrail)

local ExtraTime = 5
local HoldingRun = false

if run == true then
RunningTrail.Lifetime = RunningTrail.Lifetime + ExtraTime
HoldingRun = true
elseif run == false and HoldingRun == true then
RunningTrail.Lifetime = RunningTrail.Lifetime - ExtraTime 
HoldingRun = false

Sorry I’m not much of a help

Yes, this would be a way to do it, but the problem is that the Lifetime only affects the trail parts that are going to be generated, not ones that are already generated. So if you’re going really fast and slow down quickly, the already generated trail will still be fast, so it will disappear quickly and make the trail shorter (the first video shows that)

Thanks for the help tho

1 Like