Godot Version
4
Question
var has_apple = false
var apples_to_collect: int = 5# or ideally count the apples dynamically at the start of the game
var apples_collected: int = 0
func register_apple() -> void:
apples_collected += 1
if apples_collected >= apples_to_collect:
get_tree().change_scene_to_file("res://1st level victory.tscn")
right now the way it is, if you exit the level then come back, it wont reset the amount of apples collected to 0.