How I can make that pressing a button particles2D shows once?

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

First of all sorry for my english. I’m going to explain myself better, I want that when I press a button, particles can show (just once, I already have that config). I already have my button and my particles2D, I need to know how to link them please. Thanks for read or help =D

:bust_in_silhouette: Reply From: Wakatta

Directions

  1. Set Particles2D One Shot to true in Inspector tab
  2. Attach script to Particles2D
  3. Connect the Button pressed signal to that script (located in Node tab)
  4. Set Particles2D Emitting to true in script

Script

# Particles2D.gd
extends Particles2D

func _on_button_pressed():
    set_emitting(true)