0 votes

Hi, I'm new to Godot and I want to click on a button to generate particles and I don't know how to do it or if it's not possible how I can do to click on a specific area of my scene and when doing so the particles come out

in Engine by (19 points)

I suggest you change your question or edit this one to better fit what you want. I can see as you asking two things:
1) Generate the particles itself. where you can use the Particles or Particles2D node and add it to the scene and remove as you want.
2) Detect where the mouse is in the scene so you can set your particles scene, from above, to the correct place. Simple on 2d, i think you can get it from the mouse click event, on 3d you have to also discover where the mouse was pointing in the envionment.

1 Answer

0 votes
extends Particles

func _ready():
    # one_shot means you particle system will not repeat after it finishes
    one_shot = true

func _input(event):
    if event is InputEventMouseButton:

        #event.pressed is True when pressed / False when released
        if event.pressed == false and event.button_index== BUTTON_LEFT:
            emitting = true   # This will start the particle system
by (298 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.