0 votes

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 !

asked May 27 in Engine by quizzcode (152 points)

1 Answer

0 votes
Best answer

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 !

answered May 27 by quizzcode (152 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.