Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Andrew Maher |
I have a coin (Area2D) when the player entered it, it plays an animation that has a sound effect, and then queue free, and it doesn’t work
func _on_Coin_body_entered(body: PhysicsBody2D) -> void:
if body.name == "Player":
stats.increment_coins()
destory(true)
func play_die_anim() -> void:
$AnimationPlayer.play("die")
yield($AnimationPlayer, "animation_finished")
func destory(play: bool) -> void:
if play:
play_die_anim()
queue_free()