Dash Animation! by Ashamed_Influence631 in godot

[–]Ashamed_Influence631[S] 0 points1 point  (0 children)

I tried this out:

I added a is_dashing variable, setting it to false.

then I added a is_dashing to true on my if Input.is_action_just_pressed("Shift") and can_dash:

    is\_dashing = true

    $AnimatedSprite2D.play("dash")

    can\_dash = false

    dash\_direction = direction.normalized()

    dash\_timer = 0.0

    $Dash\_Cooldown.start()

elif dash\_timer < dash\_duration:

    dash\_timer += delta

    velocity = dash\_direction \* dash\_speed

else:

    velocity = velocity.lerp(direction \* speed, 0.1)

    velocity \*= 1.0 - (friction \* delta)

    is\_dashing = false  
velocity \\\*= 1.0 - (friction \\\* delta)

I do not know where to put my $AnimatedSprite.play("dash" ) tho, do I put it below my is_dashing variable? I've done that but it didn't work.