How can I use the Advance Condition in AnimationStateMachine?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By xynanxdb

Hi, I was exploring Godot recently and I’m trying to create a very simple Animation State Machine for a 2D sprite character. I’m currently having trouble to implement transitions using Advance Condition. Can anyone shed some light here on the Advance Condition?

:bust_in_silhouette: Reply From: Leon

Advance condition? If i dont misunderstood you

  • you need to play different animations by conditions.
    So… You need animationplayer or animationsprite
  • script
    Here in updateable function you need to check
    Conditions like below
    //
    func _process(delta):
    If condition 1:
    if currentanimation != ‘animation1’:
    Animationthing.play(‘animation1’)
    If condition 2 && condition 3:
    if currentanimation != ‘animation2’:
    Animationthing.play(‘animation2’)
    //

Condition that current animation is not the
animation you want to play is for dont restarting
Animation every tic
GL