+1 vote

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?

in Engine by (22 points)

1 Answer

+1 vote
Best answer

Hello Rakmot,

$animationPlayer.stop() will stop the animation.

$animationPlayer.seek(0, true) will reset the animation at the beginning if needed.

by (211 points)
selected by

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

$animationPlayer was corresponding to your animation fire.

For example you can do :

 func _on_reload():
  $animation_reload.play("reload")
  $animation_fire.stop()

 func _on_fire():
  $animation_reload.stop()
  $animation_fire.play("fire")

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

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

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.