Interface FollowOptions

Hierarchy

  • FollowOptions

Properties

Algorithm to use for pathfinding.

closestPointIfBlocked?: boolean

charId will move to the closest point (manhattan distance in case of 4 direction mode and with and Chebyshev distance in case of 8 direction mode) to charIdToFollow that is reachable from charId in case that there does not exist a path between charId and charIdToFollow.

distance?: number

Minimum distance to keep to charIdToFollow in manhattan distance in case of 4 direction mode and with and Chebyshev distance in case of 8 direction mode.

facingDirection?: Direction

This setting is ignored if you provide a distance other than 0.

An unblocked position adjacent to the target character with the shortest distance to the source character (the one following) is taken as a target. If there are multiple of these positions any one of them is picked. With this setting you can give an explicit position based on the current facing direction of the target character.

For Example: If you provide a facingDirection of 'down', that means that you want to follow the position the character is turned away from. So if the target character's facing direction is right, that would translate to this:

  down-left  | left  | up-left
down | (=>) | up
down-right | right | up-right
ignoreLayers?: boolean

If set to true, pathfinding will only be performed on the char layer of the start position. If you don't use char layers, activating this setting can improve pathfinding performance.

Default

false
maxPathLength?: number

If this is set, the algorithm will stop once it reaches a path length of this value. This is useful to avoid running out of memory on large or infinite maps.

Generated using TypeDoc