0 votes

hello, I wish to show particles "Explosion", when I destroy na enemy.
in a function body entered.

in Engine by (35 points)

1 Answer

0 votes

Hi,
There is no problem in doing so. First, get your particles ready (i assume you have that already). Attach the particles as child of the node you want to emmit them. Be sure to unset the emitting property from editor or from code, so the node does not emitt particles all time.

Then, i assume you already connected body_entered signal to a function, let's call on_Enemy_body_entered(body), or whatever you called that function. Inside it, you check if the enemy died, and if so, you set emitting property of particles to true:

func _on_Enemy_body_entered(body):
    if is_dead:  #here you check if enemy died, idk how you handle that in your code
        $Particles2D.emitting = true

That code was tested in godot 3.1 beta2 and worked. If you are using Godot 3.0.6, it works just calling $Particles2D.restart().

If you share me the code you have till now or the project i can help you further

by (3,505 points)
I don't get do particles
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.