move_towards
Used as a alternative to walk_towards
Vars | |
home | Should we try and stay on the path, or is deviation alright |
---|---|
moving_towards | The turf we want to move into, used for course correction |
x_rate | The rate at which we move, between 0 and 1 |
x_ticker | When this gets larger then 1 we move a turf |
Procs | |
update_slope | Recalculates the slope between our object and the target, sets our rates to it |
Var Details
home
Should we try and stay on the path, or is deviation alright
moving_towards
The turf we want to move into, used for course correction
x_rate
The rate at which we move, between 0 and 1
x_ticker
When this gets larger then 1 we move a turf
Proc Details
update_slope
Recalculates the slope between our object and the target, sets our rates to it
The math below is reminiscent of something like y = mx + b Except we don't need to care about axis, since we do all our movement in steps of 1 Because of that all that matters is we only move one tile at a time So we take the smaller delta, divide it by the larger one, and get smaller step per large step Then we set the large step to 1, and we're done. This way we're guaranteed to never move more then a tile at once And we can have nice lines