Stopping an animation at a certain time

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

So I have a reload animation and a fire animation for shooting the weapon. However, I can still use the fire animation while reloading. How can I temporarily stop or disable the fire animation while the weapon is reloading?

:bust_in_silhouette: Reply From: PEIGNAULT Laurent

Hello Rakmot,

$animationPlayer.stop() will stop the animation.

$, true) will reset the animation at the beginning if needed.

So I have put $AnimationPlayer.stop(), but I can still shoot while reloading. Is there anyway to disable the animation?

rakmot | 2021-01-09 20:03

$animationPlayer was corresponding to your animation fire.

For example you can do :

 func _on_reload():

 func _on_fire():

PEIGNAULT Laurent | 2021-01-09 20:14

Thanky ou so much for your help! It is working now!

rakmot | 2021-01-09 21:11

You’re welcome.
You can mark as solved
Happy game codding.

PEIGNAULT Laurent | 2021-01-10 12:19