|
|
|
|
Reply From: |
kakoeimon |
I have done this, this way:
var anim = get_node("AnimationPlayer")
var next_anim = "stand" #this is the animation if there is no combo
func flush_attack():
next_attack = "stand"
func do_combo():
anim.play(next_attack)
then inside the place where I check for inputs I get the actions like this
if Input.is_action_pressed("attack_1"):
var animation = anim.get_current_animation()
if animation == "attack_1":
next_attack = "attack_2"
elif animation == "attack_2":
next_attack = "attack_3"
elif animation == "attack_3":
next_attack = "attack_1"
else:
anim.play("attack_1")
Then inside the attack animations I call the function flash_attack near the beginning of the animation and at the end of the animation I call the function do_combo.
P.S. Cause my code is a little bit more complicated I wrote the answer from scratch. For example this code do not take care if you can attack.