princesse/état: copie de l'état entre niveaux

La princesse récupère son état d'un niveau à l'autre. De cette manière,
on ne perd pas les fromages.
This commit is contained in:
Thomas Lavocat
2023-05-10 20:53:27 +02:00
parent 5236599280
commit 3c6d18f746
3 changed files with 39 additions and 4 deletions

View File

@@ -21,7 +21,9 @@ func enter_door(destination : String, other_side_position : Vector2):
call_deferred("go_to", destination, other_side_position)
func go_to(destination : String, spawn_point):
var old_princesse :Princess
if current_scence:
old_princesse = current_scence.find_child("Princesse")
remove_child(current_scence)
if destination == "level_1":
@@ -42,3 +44,5 @@ func go_to(destination : String, spawn_point):
var princesse :Princess = current_scence.find_child("Princesse")
princesse.position = spawn_point
last_spawn_point = spawn_point
if old_princesse:
princesse.copy_from(old_princesse)