Skip to content

Instantly share code, notes, and snippets.

@segrax
Created March 10, 2016 02:58
Show Gist options
  • Save segrax/e8df323288f6223a56ca to your computer and use it in GitHub Desktop.
Save segrax/e8df323288f6223a56ca to your computer and use it in GitHub Desktop.
If MF_NEW_LEG is not set, then do nothing at all
If MF_TURN is not set, then just walk one step
If MF_TURN is set
we have reached a walk target (may not be the users requested destination)
If MF_IN_LEG is set, we have reached our final destination/target. Stop Actor Moving completely
If MF_IN_NOT is not set, we have reached the current target
Check the walk box number, is it the final destination walk box
Yes: Set the next walk destination to the X/Y the user clicked, set MF_IN_LEG… do calcMovementFactor
No: Get the next walkbox, check its flags, calculate the point we should walk to inside this box (towards the final destination), do calcMovementFactor
calcMovementFactor disables MF_TURN,
calculates the walk distance / direction, calls walk step.
Unless walk distance is 0, in which case it sets MF_TURN and does nothing else
Walkstep: increases or decreases the X and Y value depending on which direction we are walking (it will do both, IF your walking on enough of an angle)
Sets MF_TURN once the current destination has been reached
@segrax
Copy link
Author

segrax commented Jun 21, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment