Animation player problem

Godot Version

4.2

Question

I am making a boss fight in my game . problem is in animations , every time it does play every two animations but i dont want it.
i want when the player entered in a_detector , that play animation A and when the player entered in b_detector ,that play animation B.

please someone help !

i would recommend to set up a variable that is set to false at the beginning, and sets to true as soon you entered the detector, like this:

var entered_a = false
func _on_a_detect_body_entered(body):
  if entered_a == false:
    $AnimationPlayer.play("A")
    entered_a = true

did it work?

Hello!
I myself had done this before and it did not work; And after that I asked for help in this forum.
In any case, I have solved this problem a few month ago!
thanks for reply!

If setting a variable didn’t help, you might want to try using signals for each detector to directly trigger the specific animation. This can keep the animations more controlled based on the player’s position