The challenge simply requests to:
- Instantiate a Game Over screen when the player loses all the lives
- Set the score in the latter scene
- Add the Game Over screen node to the UI Canvas Layer.
I did all of this inside the player took damage function where the Game Over Screen is loaded when the player loses all the lives.
func _on_player_took_damage(): # Reduce lives _lives -= 1 _hud.set_lives_label(_lives) if _lives <= 0: # Remove the player _player.die() # Load and instantiate the game over screen var game_over_node = load("res://scenes/game_over_screen.tscn").instantiate() game_over_node.set_score(score) $UI.add_child(game_over_node)