Challenge - Game Over Screen

The challenge simply requests to:

  1. Instantiate a Game Over screen when the player loses all the lives
  2. Set the score in the latter scene
  3. 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
	if _lives <= 0:
		# Remove the player
		# Load and instantiate the game over screen
		var game_over_node = load("res://scenes/game_over_screen.tscn").instantiate()
1 Like

Privacy & Terms