AnimationTree nested/grouped state machine question

Godot Version

4.6.3

Question

I’ve been watching tutorials and messing with the animation tree and got movement and got some of the attack animations to work, but the organization side of me is worried that it would eventually turn into a spider web.

tried to set it up myself but it either just played the first animation in the sequence or played none of them. While doing so, I went looking for tutorials on making nested or grouped anim tree state machines, and one used it but the transition was automatic for movement/locomotion and didn’t create any other ones.

link: https://www.youtube.com/watch?v=Mg5wB-Ikn7o

There’s definitely something im overlooking and if so, may I get some pointers in the right direction that are not to vague (cause my brain struggles with overly vague answers)?

animation tree setup:

combo attack 01 standing example of use:

extends LimboPlayerState

@export var attack_component: AttackComponent
@export var animation_component: AnimationComponent

func _enter() -> void:
	attack_component.attack_duration_timer.start()
	attack_component.combo_timer.start()
	attack_component.can_attack = false
	attack_component.is_attacking = true
	agent.velocity = Vector2.ZERO
	if animation_component.animation_state_root.get_current_node() == "Movement":
		animation_component.animation_state_root.travel("attack_standing_01")

func _exit() -> void:
	attack_component.can_attack = true
	attack_component.is_attacking = false

func _process(_delta: float) -> void:
	var can_combo : bool = attack_component.combo_timer and attack_component.attack_duration_timer.is_stopped()
	
	if can_combo and input.pressed_attack:
		dispatch("COMBO_02")

func _update(_delta: float) -> void:
	if attack_component.is_attacking == false and agent.is_on_floor():
		animation_component.animation_state_root.travel("Movement")
		dispatch("FLOOR")
	
	if not agent.is_on_floor():
        Input.action_release("normal attack")
		animation_component.animation_state_root.travel("Movement")
		dispatch("FALLING")
1 Like