From ef78920014aa158da5e93216546a844fb7a58b96 Mon Sep 17 00:00:00 2001 From: TheThomaas Date: Mon, 12 Oct 2026 22:08:03 +0200 Subject: [PATCH] Update SplashScreen scene --- assets/textures/splash2.png | Bin 0 -> 8743 bytes assets/textures/splash2.png.import | 40 ++++++++++++++++++ game/ui/splash_screen/splash_screen.gd | 49 +++++++++++++---------- game/ui/splash_screen/splash_screen.tscn | 38 ++++++++++++------ 4 files changed, 93 insertions(+), 34 deletions(-) create mode 100644 assets/textures/splash2.png create mode 100644 assets/textures/splash2.png.import diff --git a/assets/textures/splash2.png b/assets/textures/splash2.png new file mode 100644 index 0000000000000000000000000000000000000000..c880e24c51100539bff77768bba94d853fce3e21 GIT binary patch literal 8743 zcmeHNdr(wW7(aJ+!5vuIg_KrNp~44Qw$Ruxnz&0CqCsemrZTyphQXApCZPge0~sw8 zn$#^K_@{Cj^SKh35h#|ww2_#VIS z_nmX^?udc1b3>qpR&pqF3tO+)lH>Wy+)cyf^ffWPp>oU%!E4{sWazY zODUM8HmDDSOrTU~hSbXho(8ocpn?RI>uY+#zG|2{8m>n8!et>345`N}kQzhQTQAm6 zsR)373Jp?WXg$T#a00}dLi37e+q$;7*KPUz{iXS|9YbG+-VT~l_M+dJ$YT>L&X-L% z(SFMao$01W9va+(o@T9N>_D#P$H#Ye6na^vCp?Jil zQ#+HsOw)!y*YGBbddPE3=-A*OSMsB}=Cy_rd*kuQ^C6&na8K4$21+QP{HTwE%jQ3_ zylzkP+-%%fT5XX_WK9ZI#)T!s|I(qg^dIlmY_4U)4Yeg<^bocn9AR83^%+ngd=4^= zHaq80d+jl}qc{VQW~>3XGfv6{GBM_2gyu0DJI)Y=!Ie$@2sNTy6lsDmg^d!rSwE@5 zmb-F$jZ{JiJ%kb#<$#2TAe=)-7p@J=4AwZ257o~$Rp{BaNq?3sQEnbN%i7%a(v;Tf z=+=;If-_R6zLX;oEn%Zjvcw4mR)Obmb^u7#2%fB%2hR z_pni{3Y3gw!6?m*XvcdxzG}RE=10l);^V&dzH6(0pWGr$Vn!!CGce5&kqO7Y>tT6) zq&)>jN(@N8OvpnMV!Of1lA$|wXzYk^xR>)faa&(h`PpZtCI|R8teCj$YqMU-t%X4t z_a;UKnP7&3!xfu6x4i8?24^K6%1CzOvQet~U>QnNm0%?{$N8D^W0FBS} z!VKy8IV~)C(VVUzJ}Ehi_^KugX*k}HL0-^2`)ReIvoE4)lz@Uc)iI)GEudu-@vwFp z$@pH4HFxEWYP~y4grWibP`W4LaY$}dwswNtPaJ8RB&;6>l5TzIs5|F-`4C% z`E}e@uDYjFm zn{?@0I+MD`*Hky*N7?1NoSZLvV0VrIwQ5e+3ba|X&Gp0TqC>~h5erYV0&5eay%rzo(rp{uVpNSj!_ z9zGQlFzWDEyXK(Lxm;qBVJVrY-N&5W zG3ZlWr-8)pGTfv%TTGEdcTY5KI{=ENotxg$Z)G&24kH|(2f0n?QvNCenE*}dsJ5Kg z@V(zpzF4`20CLJWB5(;%CtzJd_~6y0WdBYzdeGHRcE8KsfPR(+@K;ng)k3k$${54% zxXiGx{BVE%$JYG+ou&HllR$7prH_*?#guYY;^Ah|J=1&?F#Jc*Zvog+DaWXHb=Lq7 m$9vC6;Iv{qAoepH7}&TqurVw8cme#S2Z)*-6LB!y{N6uGqzUE# literal 0 HcmV?d00001 diff --git a/assets/textures/splash2.png.import b/assets/textures/splash2.png.import new file mode 100644 index 0000000..b8b0793 --- /dev/null +++ b/assets/textures/splash2.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dhovl8qbhk1xe" +path="res://.godot/imported/splash2.png-975b5ae55910322c5b4e9c302583fe54.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/splash2.png" +dest_files=["res://.godot/imported/splash2.png-975b5ae55910322c5b4e9c302583fe54.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/game/ui/splash_screen/splash_screen.gd b/game/ui/splash_screen/splash_screen.gd index 44a6940..545a2d1 100644 --- a/game/ui/splash_screen/splash_screen.gd +++ b/game/ui/splash_screen/splash_screen.gd @@ -1,33 +1,38 @@ extends Control -@onready var animated_display: TextureRect = %AnimatedDisplay -@onready var transition_rect: ColorRect = %TransitionRect - -@export var main_menu_scene_path : String = "res://game/ui/main_menu/main_menu.tscn" -@export var splash_duration : float = 3.0 +@export var load_scene : PackedScene @export var allow_skip : bool = true +@export var splash_screen_container: Node -const SCREEN_FADE_DURATION := 0.6 +@export_group("Timings") +@export var in_time : float = 0.5 +@export var fade_in_time : float = 1.5 +@export var pause_time : float = 1.5 +@export var fade_out_time : float = 1.5 +@export var out_time : float = 0.5 -var is_transitioning : bool = false +var splash_screens = [] func _ready() -> void: - await get_tree().create_timer(splash_duration).timeout - go_to_main_menu() + get_screens() + fade() 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() + if allow_skip and event.is_pressed(): + get_tree().change_scene_to_packed(load_scene) -func go_to_main_menu() -> void: - if is_transitioning: return - is_transitioning = true +func get_screens() -> void: + splash_screens = splash_screen_container.get_children() + for screen in splash_screens: + screen.modulate.a = 0.0 - 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) +func fade() -> void: + for screen in splash_screens: + var tween = self.create_tween() + tween.tween_interval(in_time) + tween.tween_property(screen, "modulate:a", 1.0, fade_in_time) + tween.tween_interval(pause_time) + tween.tween_property(screen, "modulate:a", 0.0, fade_out_time) + tween.tween_interval(out_time) + await tween.finished + get_tree().change_scene_to_packed(load_scene) diff --git a/game/ui/splash_screen/splash_screen.tscn b/game/ui/splash_screen/splash_screen.tscn index 0dc4c35..8175534 100644 --- a/game/ui/splash_screen/splash_screen.tscn +++ b/game/ui/splash_screen/splash_screen.tscn @@ -2,8 +2,10 @@ [ext_resource type="Script" uid="uid://ddxoruhyuxesc" path="res://game/ui/splash_screen/splash_screen.gd" id="1_hsxvm"] [ext_resource type="Texture2D" uid="uid://c28nuhy3im7y4" path="res://assets/textures/splash.png" id="2_4gp4q"] +[ext_resource type="PackedScene" uid="uid://bluq6da7tku3d" path="res://game/ui/main_menu/main_menu.tscn" id="2_cob3s"] +[ext_resource type="Texture2D" uid="uid://dhovl8qbhk1xe" path="res://assets/textures/splash2.png" id="4_cob3s"] -[node name="SplashScreen" type="Control" unique_id=300161700] +[node name="SplashScreen" type="Control" unique_id=300161700 node_paths=PackedStringArray("splash_screen_container")] layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 @@ -11,25 +13,37 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_hsxvm") +load_scene = ExtResource("2_cob3s") +splash_screen_container = NodePath("SplashScreenContainer") +fade_in_time = 0.5 +pause_time = 0.5 +fade_out_time = 0.5 -[node name="AnimatedDisplay" type="TextureRect" parent="." unique_id=1433597692] -unique_name_in_owner = true +[node name="ColorRect" type="ColorRect" parent="." unique_id=140381773] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +color = Color(0.14117648, 0.14117648, 0.14117648, 1) + +[node name="SplashScreenContainer" type="MarginContainer" parent="." unique_id=71933636] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Screen1" type="TextureRect" parent="SplashScreenContainer" unique_id=1430161342] +layout_mode = 2 texture = ExtResource("2_4gp4q") expand_mode = 1 stretch_mode = 6 -[node name="TransitionRect" type="ColorRect" parent="." unique_id=33546617] -unique_name_in_owner = true -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -color = Color(1, 1, 1, 0) +[node name="Screen2" type="TextureRect" parent="SplashScreenContainer" unique_id=708644296] +layout_mode = 2 +texture = ExtResource("4_cob3s") +expand_mode = 1 +stretch_mode = 6