how to dash player

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Newby
:warning: Old Version Published before Godot 3 was released.

How can i make it so when the player dashes forward gravity doesnt affect him for the duration of the dash.

:bust_in_silhouette: Reply From: eons

Depends on the design, could be as simple:

if dashing:
 velocity.y = 0

Or if using states just don’t apply gravity to the motion.

i am using a rigidbody 2d so the gravity is already add so how can i stop it for the dash
i have a code in my ready function for gravity strength set_applied_force(Vector2(0,extra_gravity)) i want to kow how to disable it on dash

Newby | 2017-11-21 05:25

if you are using rigid body for this kind of custom physics, the control of the body should be done in _integrate_forces (custom integrator enabled), you will have to null the y component of the state velocity on every step.

Check the platformer demo for a full rigid character movement example.

eons | 2017-11-22 03:38