Godot Version
v4.3.stable.arch_linux
Question
I made a game in which when you kill an enemy it gives you one token, I added that functionality in the “died” signal like this:
tokens = 0
func _on_health_component_died() -> void:
tokens += 1
print(tokens)
$Explosion_Particles.emitting = true
await $Explosion_Particles.finished
queue_free()
When I execute that code, the “tokens” variable doesn’t increment by one; it increments by 32, and the “print(tokens)” line is executed 32 times, too. I don’t know why it is looping, but I suspect it is because the “await” keyword loops over the code until its requirement is met.
Is there any way to make the code only run once, Thanks in advance
PD: I’m not an English speaker, I’m using Grammarly right now, I apologise for any misspelt word or confusing sentence