NoelFB / Celeste

Celeste Bugs & Issue Tracker + some Source Code
MIT License
3.58k stars 425 forks source link

What the function Calc.Approach(x, y, z) do? #42

Closed Perh0nen closed 1 year ago

Perh0nen commented 1 year ago

image It's been used in many places. Wonder what's the specific meaning it return?

NoelFB commented 1 year ago

It makes X approach Y by a delta of Z, but doesn't overstep it.

float x = 10, y = 23, z = 5;
x = Calc.Approach(x, y, z); // x = 15 now
x = Calc.Approach(x, y, z); // x = 20 now
x = Calc.Approach(x, y, z); // x = 23 now