Hello! I am trying to “animate” when a player is rescued from water, and having some trouble making it look how it should.
Currently, I have a little helicopter sprite spawn above the player, and the player teleports to the respawn point. However, I want it to look like the player is slowly moving from where they touched water to the respawn point. However, I can’t seem to really find any information on this? Any research on interpolation just leads me to smoothening gameplay (which was helpful! Just not for this!) and I couldn’t seem to find any other methods for this.
Should I be trying to use linear_interpolate()? Or tweens? Or something else?
Oh I see. How do I tie it to the animation? I have an animation that lasts 3 seconds, and I have a function that has “$Player1.position = position.lerp(p1Spawn, 1)”.
So, after I tie the lerp to the animation, it should automatically make it smoothly teleport there over the course of the 3 seconds, correct?
You would want a use a smaller then 1 lerp step. Set the position many times in a physics process function.
Lerp step of 1 will make the jump in one frame. A lerp step of 0.1 will take 10 frames, a lerp step of 0.01 will take 100 frames or around 1.6 seconds.