There's quite a few ways to do it, so it depends on the type of dash you're using. If it's a one-shot fixed burst of speed you could do the following:
var dashDistance: float = 100.0
var isDash: bool = false
var dashCooldown: float = 0.0
var is_facing_right: bool = true
if Input.is_key_just_pressed( "Dash" ):
if dashCooldown <= 0.0:
isDash = true
dashCooldown = 0.5
if Input.is_key_pressed( "ui_right" ):
is_facing_right = true
velocity.x += RUN_SPEED
if Input.is_key_pressed("ui_left"):
is_facing_right = false
velocity.x -= RUN_SPEED
# add other movement code
if isDash:
if is_facing_right:
velocity.x += dashDistance
else:
velocity.x -= dashDistance
dashCooldown -= delta
if dashCooldown <= 0.0:
isDash = false
move_and_slide()```