PathFindingApi class

API responsible for finding paths using A* and moving the component through them.

The parent component must have a Movement mixin.

Constructors

PathFindingApi(Movement _comp)

Properties

hashCode int
The hash code for this object.
no setterinherited
isMoving bool
Whether the component is currently moving along a path.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Cleans up path line component when the component is removed.
getPathToPosition(Vector2 position, {List<GameComponent>? ignoreCollisions}) List<Vector2>
Returns the path to position without moving the component.
moveAlongThePath(List<Vector2> path, {VoidCallback? onFinish}) → void
Makes the component follow a previously calculated path.
moveToPosition(Vector2 position, {List<GameComponent>? ignoreCollisions, VoidCallback? onFinish}) Future<List<Vector2>>
Moves the component to position using A* path finding.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onFinishListener(PathFindingFinishCallback callback) → void
Registers a callback fired when the component reaches the path end.
render(Canvas canvas) → void
Renders debug barriers if enabled.
setup({bool? linePathEnabled, Color? pathLineColor, Color? barriersCalculatedColor, double pathLineStrokeWidth = 4, bool showBarriersCalculated = false, bool useOnlyVisibleBarriers = true, bool useAreaBetweenPlayerAndTarget = false, bool gridSizeIsCollisionSize = false, bool withDiagonal = true, double factorInflateFindArea = 2}) → void
Sets up path finding visuals and behavior.
stop() → void
Stops following the current path.
toString() String
A string representation of this object.
inherited
update(double dt) → void
Updates path following movement.

Operators

operator ==(Object other) bool
The equality operator.
inherited