How to add a 4 seconds of Input delay

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MarieMooMoo

I want to add 4 seconds of input delay to a shadow character that follows the player around at all times but meets up with them after the 4 seconds have passed.

but i cant find a method of implementing this anywhere. Any ideas?

I want to add the delay to all of the actions that the player does. at the moment they only have 3 actions. Where the delay is needed is highlighted with the red line

yield(get_tree().create_timer(4), "timeout")

Wakatta | 2020-08-29 21:36

:bust_in_silhouette: Reply From: RedStone-007

#if you are going to use the same delay .i.e.4 seconds, you can first create a variable. it is completely optional but can come handy so it goes like -

var delay = 4

    if Input.is_action_pressed("MoveRight"):
     yield(get_tree().create_timer(delay), "timeout")
     #put your movement output here`enter code here`

I tried this and the previous solution but now its making a bug of its own. and its like. really anoying

if you want to talk more i have discord: MarieMoo#0259

MarieMooMoo | 2020-08-30 19:49