The immediate problem I see is that your Attack 1
animation is being triggered by Input.is_action_just_pressed
, which is only true in the single frame where the action button was pressed. So, in that one frame, it'll start to play the animation, but in the very next frame, that call will return false. Based on your code, that next frame would process the code in the else
block, which causes the Idle
animation to play again.
The most obvious thing to do is simply remove the else:
block all together. By the looks of it, you'll already play the idle animation if you're grounded (higher in your code), so that might work for you.
That said, your input processing code is likely much more complex (and redundant) than necessary, which makes working this out more difficult than necessary...