Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How To Setup Pathing For a FlxSprite
import flixel.util.FlxPath;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.util.FlxColor;
class Player extends FlxSprite {
public var walkPath:Array<FlxPoint>;
public function new(x:Float, y:Float) {
super(x, y);
makeGraphic(16, 16, FlxColor.WHITE, true);
walkPath = [new FlxPoint(0, 0), new FlxPoint(100, 100)];
//Creates a new FlxPath for the player to follow
this.path = new FlxPath(walkPath);
//Starts the player moving along the path and back again without stopping.
this.path.start(null, 50, FlxPath.LOOP_FORWARD);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment