extends Control @onready var animated_display: TextureRect = %AnimatedDisplay @onready var transition_rect: ColorRect = %TransitionRect @export var main_menu_scene_path : String = "res://scenes/main_menu.tscn" @export var splash_duration : float = 3.0 @export var allow_skip : bool = true const SCREEN_FADE_DURATION := 0.6 var is_transitioning : bool = false func _ready() -> void: await get_tree().create_timer(splash_duration).timeout go_to_main_menu() func _unhandled_input(event: InputEvent) -> void: # permet de passer le splash en appuyant sur une touche ou en cliquant if allow_skip and !is_transitioning and event.is_pressed() and (event is InputEventKey or event is InputEventMouseButton): go_to_main_menu() func go_to_main_menu() -> void: if is_transitioning: return is_transitioning = true transition_rect.visible = true transition_rect.modulate.a = 0.0 var tween := create_tween() tween.tween_property(transition_rect, "modulate:a", 1.0, SCREEN_FADE_DURATION) await tween.finished get_tree().change_scene_to_file(main_menu_scene_path)