Progressive speed



I created a speed variable for the player and I would need that if the variable is set to 0, make it rise progressively up to 50.
when the variable is 0 and I reset the player speed to player.speed (50) it is accelerated too much.

Use a tween gradually increase the force applied:

  1. Change the name of the variable speed to maxSpeed, and add another variable currentSpeed, initial value 0.

  2. Tween currentSpeed to player.maxSpeed over the time you’d like the acceleration to take.

  3. In the event you posted, change the player.speed to player.currentSpeed.

1 Like

Hi, thanks for the advice and forgive me for waiting for the reply.
this is what I felt:

At this point how do I reset the speed when the player stops? I tried adding the idletracker extension by adding a once trigger but rightly it only works once

Have you tried the condition inverting Any key pressed (with a trigger once), and for actions removing the “move” tween and adding tween to change currentspeed to 0?

the problem is that I hadn’t removed the tween. I had never used interpolation to manage a variable. it works now, thanks!