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:
var spaceship = get_node("root to your spaceship")
if body.get_name() == "spaceship":
spaceship.visible = false
to do this, add an animationplayer an make the explosion with the animationplayer.