I solved this problem by calling queue_free()
on the player when they die, but it depends on your set-up (if the camera is a child of the player, it will disappear too; death animations might not play if they're children of the player, etc).
You can disable input with set_process_input(false)
, so one way to do it might be:
func die():
set_process_input(false)
yield(get_tree().create_timer(1.0), "timeout")
queue_free()
The timer you create with yield(get_tree().create_timer(1.0), "timeout")
would give you space to play the animation (make it as long as the animation), and then you can remove the player from the scene.
Hope this helps!