How to code: if particles 2d are emmited call func

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

i wanna call a function after emmiting particles: if emmiting is over, call func

:bust_in_silhouette: Reply From: godot_dev_

You could use a timer, similar to the logic suggested in the thread here. I believe you could achieve your goal as follows:

  1. Add a script to your particles node
  2. Override the set_emitting function of Particles2D, and start the timer whenever the provided flag is true while the particles emitting member was false. Don’t forget to do emitting = value, to make sure you don’t break the particles API. This way, you have a timer that starts ticking only when particles start emitting again
  3. When the timer ends (via signal handling by connecting your function to the timeout signal of the Timer node), you can call your function

If you configured the timer lifetime to correctly match the particle emission lifetime, this should achieve what you are trying to do