Gpu particles emit multiply (polymorphism) like a audiostreamer

Godot Version

4.3

Question

So i want to emit this particles every time the player collected a Coin-like-item. But is most likely that the player collected 5-10 Coins in a very short time period.
How to make it, so that the GPU Particles fires every time? My workout is dupilcate the Particles, but is there a better way then just duplicate is 5-6 times ?

And my code looks like this with on 2 duplications

func _call_berryscore_animation(quantity:int):
	if $HUD/show_particles .emitting == false:
		$HUD/show_particles.amount = quantity
		$HUD/show_particles.emitting = true
	else:
		$HUD/show_particles2.amount = quantity
		$HUD/show_particles2.emitting = true

Any Advice is appreciated

1 Like

Spawning multiple gup particles would be the easiest and you shouldn’t have a problem if you free them after they are used.

Create a scene that is your gpu particles and set the one_shot flag to true. In script, listen for the finished signal from the particles and queue_free() them afterwards. Don’t forget to set emitting = true in the _ready() function. Instantiate that scene when you need it and add the instance to the scene tree. It should free itself when the particles have finished one emitting cycle.