if your bullet that hits your ship, has an area, do this in the bullets script: connect the area to your main script on "area body entered", then you will get this:
func _on_Area_body_entered(body):
pass
you add:
func _on_Area_body_entered(body):
var spaceship = get_node("root to your spaceship")
if body.get_name() == "spaceship":
$animationplayer.play("explosion")
spaceship.visible = false
to do this, add an animationplayer an make the explosion with the animationplayer.