Skip to content

Make Particles emit a signal when all particles finished #649

Closed
godotengine/godot
#76853
@Anyeos

Description

Describe the project you are working on:
A simple shoot em game with explosions.

Describe the problem or limitation you are having in your project:
It is unelegant when you make an explosion or some other effects write a lot of code to only call queue_free().

Describe the feature / enhancement and how it helps to overcome the problem or limitation:
If I have a signal for the Particles2D and Particles in general when it stop emitting, I can attach a function to it and call directly queue_free() when it finish. Or make more complex effects like spawning another particle.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

func _on_Particles2D_finished():
  queue_free()

If this enhancement will not be used often, can it be worked around with a few lines of script?:

extends Node2D

var lifetime

func _ready():
	lifetime = $Explosion.lifetime
	$Explosion.emitting = true

func _process(delta):
	lifetime -= delta
	if lifetime < 0:
		queue_free()

Is there a reason why this should be core and not an add-on in the asset library?:
Because it is easy to implement signals like the ones of AnimatedSprite

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      Implemented

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions