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