trigger a collision based on a particular frame in an animation

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

so first off look at this scene :

you can see that the oil barrel starts receiving damage even before the characters foot hits it. the dent animations start immediately on the characters first frame. whereas i want it to connect on the 5th frame of the kick . how do I trigger the event on a specific frame ?

below is the character script:

and the oil barrel script:

:bust_in_silhouette: Reply From: Gluon

You can check if a sprites frame is on a particular number like this

if $ExampleSpriteName.frame == 5:

You can then have a signal sent out so for instance if you have a boolean to control if you start kicking and then check if the sprite frame is on 5 then you can send a signal to your oil barrel to start its code.