Hi,
I am trying to signal the end of animations to initiate another state, and it functions as it should, but I am getting this error: ERROR: Invalid method call.
Should I be declaring the reference in the script?
Thanks
extends PlayerState
var attack_combo = 1
var comboing : bool
func enter() -> void:
comboing = false
if attack_combo == 1:
player.anim_player.play("Attack")
if attack_combo == 2:
player.anim_player.play("NeutralAttack2")
if attack_combo == 3:
player.anim_player.play("neutral_attack_3")
func physics_update(delta: float) -> void:
print (attack_combo)
print (comboing)
if Input.is_action_just_pressed("attack"):
comboing = true
func _on_AnimationPlayer_animation_finished(anim_name):
if anim_name == "Attack":
if comboing == false:
state_machine.transition_to("Idle")
attack_combo = 1
return
elif comboing == true:
attack_combo = 2
state_machine.transition_to("Neutral_Attack")
elif anim_name == "NeutralAttack2":
if comboing == false:
attack_combo = 1
state_machine.transition_to("Idle")
comboing = false
return
elif comboing == true:
attack_combo = 3
state_machine.transition_to("Neutral_Attack")
elif anim_name == "neutral_attack_3":
state_machine.transition_to("Idle")
attack_combo = 1
comboing = false
return
func exit() -> void:
pass
