0 votes

I'm working on a project that has player control but heavily uses AnimationPlayer Nodes. Is there any way to remove the script while this animation plays and then return it at the end?

asked Jul 10 in Engine by Friends-Games (80 points)

1 Answer

+1 vote
Best answer

I believe this can only be done through a function or variable created manually under the kinematic body's node.

Modify your input code so that the body only takes inputs when another variable is true.

The way I structure my projects s to have a function handle all the inputs on the player, so I would just adjust the code under physicsprocess so look like:

if controllable:
  get_input()

Then if in the animation player you change the variable controllable between true and false, you should be able to add or remove control from the player, while also letting the rest of the necessary scripts run.

answered Jul 11 by RedBlueCarrots (211 points)
selected Jul 12 by Friends-Games

^This
If you export the variable you can even key it through the inspector.

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 How to use this Q&A? before posting your first questions.