A simple ordered list of nodes that iterates based on conditions. For this class, that condition is not defined, and must be implemented in your extending class.

Example

The following is an example of a class that moves the target to the next node and and advances the iterator when it is near.

class SimplePath extends flixel.path.FlxBasePath
{
	public var speed:Float;
	
	public function new (?nodes, ?target, speed = 100.0)
	{
		this.speed = speed;
		super(nodes, target);
	}
	
	override function isTargetAtNext(elapsed:Float):Bool
	{
		final frameSpeed = elapsed * speed;
		final deltaX = next.x - target.x;
		final deltaY = next.y - target.y;
		// Whether the distance remaining is less than the distance we will travel this frame
		return Math.sqrt(deltaX * deltaX + deltaY * deltaY) <= frameSpeed;
	}
	
	override function updateTarget(elapsed:Float)
	{
		// Aim velocity towards the next node then set magnitude to the desired speed
		target.velocity.set(next.x - target.x, next.y - target.y);
		target.velocity.length = speed;
	}
}
Available since

5.9.0

.

Alias