Making a Dash Mechanic

Godot Version

Godot 4

Question

Fundamentals for a dash sort of thing??

Also I’m sorry for the basic question, I’m just new to GDScript.

What it does:

Makes the player go in a straight line for a second.

Makes the player go in a straight line from where they’re facing.

Stops the gravity.

After that second, gravity turns back on and the player resumes as normal.

I answered a similar question a while ago on this forum. Read through this post for help Dash/Movement help

If you’re still not sure of what to do, I can help you with the parts you don’t understand.

1 Like

What you’re looking for is a celeste/ hollow knight like dash. To implement that sort of thing, you’ll definitely need a timer node attached to the player node. You want to store the last movement that the player was in by doing something like:

var direction = Vector2.ZERO 

if last_dir != Vector2.ZERO:
		last_dir = direction

then add velocity to that:

velocity = velocity.move_toward(dash_direction.normalized() * dash_speed, accel * frict)
		move_and_slide()

It’s best now that you know what you’re looking for though to look up videos for a “celeste” or “hollow knight” dash and follow along (or just look up other games with the dash you’re looking for)