I got really, really close to what I wanted.
There's only 1 issue with this code (besides the fact (it is a mess),
if the player hits the ground while holding the Dash Button, the character will dash and that's just not good.
func _physics_process(delta):
var move_dir = 0
var dash = 1
var grounded = is_on_floor()
Normal Run
if Input.is_action_pressed("ui_right"):
move_dir += 1
if Input.is_action_pressed("ui_left"):
move_dir -= 1
Dash movement
if grounded and Input.is_action_pressed("Dash"):
print (timedash)
timedash += delta
if is_on_wall():
timedash = 0
dash_impulse = 1
if timedash == 0 or timedash > 0.6:
dash = 1
if timedash > 0 and timedash < 0.6 and grounded:
dash = 2.333333333333333
if Input.is_action_just_released("Dash"):
timedash = 0
if grounded:
dash_impulse = 1
if not grounded and timedash > 0:
dash_impulse = 2.333333333333333
GENERAL SPEED CODE
move_and_slide(Vector2(move_dir * MOVE_SPEED * dash * dash_impulse, y_velocity), Vector2(0,-1))