Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add FlxBasePath, extends base in FlxPath #3153

Merged
merged 16 commits into from
May 30, 2024
Merged

Conversation

Geokureli
Copy link
Member

@Geokureli Geokureli commented May 28, 2024

FlxPath does too much, in a way that makes it hard to do anything else. FlxBasePath allows to you create your own follow logic. This is mainly because FlxPath has a lot of features that I feel I need to work around, and other features that, frankly, don't make any sense to me, like axes.

FlxBasePath is also a complete overhaul of FlxPath and will eventually fecilitate it's replacement in a (much) later version. Here's is a list of those changes:

  • Paths extend FlxBasic and behave in line with most other flixel objects. This means you can add a path to a group to control an object, too.
  • onComplete = func; is deprecated for onEndReached.add(func);, also added onFinished and onNodeReached
  • Base paths do not make a copy of nodes passed into the constructor, if you want a copy, make a copy
  • Base Paths do not have FlxPath's start function or setProperties function. To stop or disable a path set it's active to false. If a nodes and target is supplied in the constructor, it will begin, if not it is considered finished and you'll need to supply nodes, a target and call restart() or startAt(i)
  • You should see NO DIFFERENCE in the behavior of FlxPaths, if you do, let me know

Note: FlxObject.path is still a FlxPath, if you want to use custom path logic you'll need to manage it yourself

Long Term

I'd like to deprecate FlxPath or rename it to FlxPathLegacy and then make a new simplified version that doesn't have: axes, immovable and all the specific functions currently replaced by new FlxBasePath ones

To Do

Thoroughly check that FlxPath still works, lol

  • Check Pathfinding demo
  • Check debug draw

@Geokureli Geokureli merged commit f303413 into HaxeFlixel:dev May 30, 2024
11 checks passed
@Geokureli Geokureli added this to the 5.9.0 milestone May 30, 2024
@Geokureli Geokureli deleted the base-path branch June 11, 2024 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant