will trigger once and never again ?

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

Hey there !
I want to trigger an animation when at least 1 enemy is with in range of my building.
Everything works great but the animation will play only once and never again.

I have read about having to .stop() it before it even start and many other “hints” here an there. But nothing works…

It will play once and that’s it. (The animation isn’t loop).
I checked my code and the “print” is being triggered every single time. so i figured so should the animation. but no…

func find_multi_target(multi_target_amount, range_attack = 1):
#This function finds X targets in range and shoot at "multi_target_amount" of them
if can_shoot: #cooldown is good to go
	var units
	units = get_overlapping_bodies()
	if units.size() > 0: #we have at least a target.
		if ranged_attack == 0:
			print("Why not playing ?")

the rest of the function isnt here as it serve no purpose.
Am i formulating this wrong ? I don’t get it. Do I need to reset the frame to 0 ?
Thanks !

:bust_in_silhouette: Reply From: quizzcode

Lovely. I questioned the fact of setting my frame to 0 after the animation was done.
And it’s working :

$melee_animation.frame = 0

thx !