niveau/transitions: shader de transition

Entre les niveaux et à la mort il y a maintenant un fondu au noir qui se
met en place pour éviter d'avoir la gerbe sur les mouvements de caméra.
la physique est en pause pendant la transition.
This commit is contained in:
Thomas Lavocat
2023-05-11 08:53:46 +02:00
parent bd85e22644
commit 5678bd8c55
13 changed files with 240 additions and 7 deletions

18
game.gd
View File

@@ -13,6 +13,9 @@ var last_spawn_point = null
var princesse : Princess = null
var goto_destination
var goto_spawn_point
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
go_to(scene_name, null)
@@ -25,11 +28,20 @@ func enter_door(destination : String, other_side_position : Vector2):
call_deferred("go_to", destination, other_side_position)
func go_to(destination : String, spawn_point):
goto_destination = destination
goto_spawn_point = spawn_point
hud.begin_scene_transition()
func _on_hud_screen_is_black() -> void:
var destination = goto_destination
var spawn_point = goto_spawn_point
var old_princesse :Princess = null
if current_scence:
old_princesse = current_scence.find_child("Princesse")
old_princesse.disconnect("cheese_collected", hud_load_cheese)
old_princesse.disconnect("dash_fart", hud_unload_cheese)
#old_princesse.disconnect("princess_is_dead", princess_death)
remove_child(current_scence)
if destination == "level_1":
@@ -54,6 +66,9 @@ func go_to(destination : String, spawn_point):
princesse.copy_from(old_princesse)
princesse.connect("cheese_collected", hud_load_cheese)
princesse.connect("dash_fart", hud_unload_cheese)
#princesse.connect("princess_is_dead", princess_death)
hud.end_scene_transition()
# vient de la princesse quand elle a ramassé un fromage
func hud_load_cheese():
@@ -67,3 +82,6 @@ func hud_unload_cheese():
# quand le fromage est chargé, le jeu le signale à la princesse
func _on_hud_fart_reloaded() -> void:
princesse.reload_fart()
func _on_hud_screen_is_ready() -> void:
princesse.go_out_and_play()