why animation change to other animation in middle play?

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

i have 2 tower one magic and other basic damage, i make display when they hit. if one type tower everything seem ok, but when two type tower hit enemy, my display messup, its ok when one type hit at time, but when both hit at same time, the display change between magic display and basic damage display at middle display play,
for example
first , when first tower(basic damage) hit display value come out with red color, but before animation finish , second tower(magic damge) hit another enemy both value change color to blue

how should it fix it?

damage_label

extends Control

var damage_display :int 
var critical_damage: bool = false
var magic_damage : bool = false

func _ready() -> void:
	if critical_damage == true:
		$AnimationPlayer.play("crit_damage_display")
	elif magic_damage == true:
		$AnimationPlayer.play("mana_damage_display")
	else:
		$AnimationPlayer.play("damage_display")

func _process(delta: float) -> void:

	$damage_disply.text = str(damage_display)
	if $damage_disply.self_modulate ==Color("00ffffff"):
		queue_free()


func damage_value(value,crit,magic):
	damage_display = value
	critical_damage = crit
	magic_damage = magic

enemy

func on_hit(min_damage,max_damage,crit_chance,crit_on_off,magic_on_off):
	
	var damage_type :int # can choose crit/magic/normal formula
	
	var ad_random_damage = int(rand_range(min_damage,max_damage))
	var ap_random_damage = int(rand_range(min_damage,max_damage+999))
	var random_pos =randi()% 3+1
	var crit_damage_value = ad_random_damage + int ( rand_range(min_damage,max_damage))
	
	var magic_damage_display :bool = false
	var crit_damage_display : bool = false
	var crit_random_change : float = randf() #random float for crit 
	if crit_on_off == true:
		hp -= ad_random_damage
		damage_type = ad_random_damage
		if crit_random_change <= crit_chance:
			hp -= crit_damage_value
			crit_damage_display = crit_on_off
			damage_type = crit_damage_value
	elif magic_on_off == true:
		hp -= ap_random_damage
		magic_damage_display = magic_on_off
		damage_type = ap_random_damage

bullet 1

func _on_bullet_body_entered(body: Node) -> void:
	if body.is_in_group("enemy"):
		body.on_hit(min_damage,max_damage,crit_chance,crit,magic)#min_damage,max_damage,crit_chance,crit on/ of,magic on/ of

bullet 2

func _on_skill_body_entered(body: Node) -> void:
	if body.is_in_group("enemy"):
		body.on_hit(min_damage,max_damage,crit_chance,crit,magic) #min_damage,max_damage,crit_chance,crit on/ of,magic on/ of