Image #1
Welcome to the wonderful world of programming.
In your above code every if
will be tested and every one to be true will be executed in terms of animation that will be the last one to be shown
What you're looking for is called an elif
conditional statement that must follow an if
block
It basically means else if
if a:
do_a()
elif b:
do_b()
elif c:
do_c()
else:
do_nothing()
And what happens during execution is if thea
condition is false then the b
condition is tested and so on until the last elif
or else
Image #2
var last_move_pos = 0
func shoot():
if AnimPlayer.is_playing():
AnimPlayer.stop()
last_move_pos = AnimPlayer.get_current_animation_position()
AnimPlayer.play("Kick")
func move():
if AnimPlayer.is_playing():
AnimPlayer.stop()
AnimPlayer.advance(last_move_pos)
AnimPlayer.play("Move")
With more animations and more complex blending it would be better to use an AnimationTree