I am trying to use the double tapping as a dash mechanic for my project but as a bigginer, am lost on how to make the dash work with the double tapping.
const SPEED = 300.0
const DOUBLETAP_DELAY = .25
var doubletap_time = DOUBLETAP_DELAY
var last_keycode = 0
func _physics_process(delta: float) -> void:
doubletap_time -= delta
if direction:
(Speed up)
velocity.x = lerp(velocity.x, direction * SPEED, 0.05)
else:
# Friction
velocity.x = lerp(velocity.x, 0.0, 0.05)
(by xyz) Double tap
func _input(event):
if event is InputEventKey and event.is_pressed():
if last_keycode == event.keycode and doubletap_time >= 0:
print("DOUBLETAP: ", String.chr(event.keycode))
last_keycode = 0
else:
last_keycode = event.keycode
doubletap_time = DOUBLETAP_DELAY
the double tap works but i don't know how to make it work with speed or as like a dash.
I did try some stuff like changing const on SPEED with var and using +=, wich overwritten the speed.
what is the best and the most simple way to make you boost on a tick or a bit so its like a dash?
"also this is my first time using this post"