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

Allow linear drag and max speed, drag on skid #3110

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from

Conversation

Geokureli
Copy link
Member

@Geokureli Geokureli commented Apr 16, 2024

Attempt number 2 at #2704:

Allow linear drag and max speed

Meaning it's calculated based on velocity's magnitude rather than the individual x/y speed. New fields: dragMode and maxSpeedMode

Examples

// old code
// drag.x = drag.y = 800;
// maxVelocity.x = maxVelocity.y = SPEED; // possible to go SPEED * sqrt(2)

// new code
dragMode = XY(800, 800); // behaves identical to old code
maxSpeedMode = LINEAR(SPEED); // impossible to go faster than SPEED

Drag on skid

New field dragApplyMode:
INERTIAL - old behavior where drag is applied when acceleration is 0
ALWAYS - drag is always applied
SKID - drag is applied when inertial or decelerating

TO DO

  • Docs
  • Unit tests
  • Allow different drag modes for X/Y (important for platformers) this might kill this feature if I don't do this right
  • Remove deprecation warnings (only added them to remove refs in other flixel tools)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant