0 votes

I know I can use onTextBoxanimationfinished but I'm looking for an active way to check it anywhere e.g. a var that's true or false. Not sure what I could use. Basically I have a textbox that "slides" open when you talk to an NPC, but if you spam the "talk" button that brings it up, it interrupts this animation (I have multiple animations in this one player). So I'm trying to disable that neatly to make sure the input only works when the box has finished animating. Thanks.

in Engine by (151 points)

4 Answers

–5 votes
Best answer

My problems are solved now if I just split up all my animations into a different player node for each one.. A bit wasteful, but it'll have to do for now. No idea how to do this without a signal, still would appreciate any help there.

by (151 points)
0 votes

I think you can do:

if Animation.current_animation == "name of animation"
by (530 points)

Thanks, tried that but it doesn't seem to work. My problems are solved now if I just split up all my animations into a different player node for each one.. A bit wasteful, but it'll have to do for now.

0 votes

For anyone still wondering. You can use $Sprite.animation to get the animation. Then use an if statement to check if that's the animation that you need.

by (16 points)
0 votes

I know this is an old question but it's something I just had an issue with and couldn't directly find an answer for so I thought I would add what worked for me specifically.

You can use this code to check what animation is currently playing:

$AnimationPlayer.getcurrentanimation()

So for my example I use it as a check because I want my attack animation to play over anything else so before each animation I have this line:

if $AnimationPlayer.getcurrentanimation() != "Attack":

then I would have the code to play whatever animation should be playing without the attack.

by (14 points)
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.
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 webmaster@godotengine.org with your username.