This is comment for paste
Approach()
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- here is an updated code for newer GMS2 versions like (v2024.06.2.162)
- function Approach(_value,_value_to,_amount)
- {
- if (_value < _value_to)
- {
- _value += _amount;
- if (_value > _value_to)
- return _value_to;
- }
- else
- {
- _value -= _amount;
- if (_value < _value_to)
- return _value_to;
- }
- return _value;
- }
- Keep in mind you can't write the function and expect it to alter a value on its own. You have to write the whole instruction, like this:
- y = Approach(y, target_y, move_speed);
- and not
- Approach(y, target_y, move_speed);
Advertisement
Add Comment
Please, Sign In to add comment