Godot Version
4.6
Question
i put the sound effect in and the player2d yet it’s not working
extends Area2D
func _on_body_entered(body: Node2D) -> void:
if body is PlayerController:
$"Coin collected".play()
var tween = create_tween()
tween.tween_callback(self.queue_free)
How did you solve it? In case someone with a similar issue finds this post.
It seems like your tween was instantly finishing thus destroying the coin. Maybe you wanted to delete after the sound/animation played.
extends Area2D
func _on_body_entered(body: Node2D) -> void:
if body is PlayerController:
$"Coin collected".play()
await $"Coin collected".finished
self.queue_free()
1 Like