How can I add a timer to Particle System ?

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

Alright guys so what I want to do is that I have created a lethal cauldron in my game from which particles emit. But I want the particles to come out after every 2 Seconds. How can I achieve that ?

:bust_in_silhouette: Reply From: estebanmolca

One way would be to set the lifetime property to for example 2 seconds and increase the explosiveness parameter to force the particles to all go out together.
Another way is with a Timer:
Set the one_shot property of the particle to on. Then from code you can use the emitting property to turn on the particles. Every time you use for example $ particle2D.emitting = true the particles will start. When one_shot is activating, they will turn off when they complete their lifetime. You can use a Timer or any other event to trigger this.
I forgot to mention how to use the Timer node: Add a Timer node to your scene, set the desired time to wait_time property and autostart to on. Go to the node tab where the signals are and connect the timeout signal to your script:

func _on_Timer_timeout():