eastern-flames/eastern flames/scripts/linear_approach/linear_approach.gml

6 lines
183 B
Plaintext
Raw Permalink Normal View History

2022-08-15 04:06:41 +00:00
function linear_approach(val, goal, amount) {
if abs(val-goal) < amount val = goal;
if val < goal return val+amount;
if val > goal return val-amount;
if val == goal return goal;
}