I can think of a few ways that would probably work...
If the sprite is being animated via an
AnimationPlayer, you can add a
call method track at the end of the animation timeline. That'll call a function you define every time the animation reaches the end.
In that function, you could manage your counter and/or decide to stop the repeating animation and call your mentioned "done" function.
Alternatively, you could set the animation to not loop (so, to only play once). Then, you could hook up the animation's
animation_finished signal. In the code called by that signal, you could manage your "counter" variable. If you haven't yet reached the maximum number of plays, just play the animation again. Otherwise, call your "done" function.