Godot Version
``if Input.is_action_just_pressed(“combat”):
print(cooldown_active)
if cooldown_active == true:
return
elif combatmode == false:
combatmode = true
cooldown_active = true
timer.start()
else:
combatmode = false
cooldown_active = true
timer.start()
if combatmode == true:
anim.play("combat")
else:
anim.play("Idle")
if Input.is_action_just_pressed("hit"):
if combatmode == true:
anim.play("Punch")
Question
I’m trying to do punch animation, but the animation is too fast. I’m using animatedsprite2d
You can use the speed_scale property of the AnimationPlayer to slow down the animation in your code.
Animationplayer.speed_scale = 1.0
1.0 is default speed and values that are lower slow it down.
Edit: Just realized you’re not using an Animationplayer, but the Animatedsprite2D should still have a speed_scale property you can tweak
I assume this in executed in _process() or _phsyics_process()? If that’s the case, the “Punch” animation will only play for one frame / physics tick, and then be overwritten by either “combat” or “Idle” animation.
You would have to implement a way to prevent those animations from immediately overwriting the “Punch” animation (either for a certain amount of time or until the animation has fully played once).