diff --git a/AssetSrc/splash.afphoto b/AssetSrc/splash.afphoto new file mode 100644 index 0000000..819e172 Binary files /dev/null and b/AssetSrc/splash.afphoto differ diff --git a/Scenes/Global/Loader.gd b/Scenes/Global/Loader.gd index d93c8a5..460c1ce 100644 --- a/Scenes/Global/Loader.gd +++ b/Scenes/Global/Loader.gd @@ -13,7 +13,7 @@ func _ready(): set_process(false) func load_scene(path: String): - current_scene = root.get_child(root.get_child_count() -1) + current_scene = get_tree().current_scene loading.fade_in() load_next = path @@ -21,11 +21,12 @@ var delay := 0.1 var cur_delay := 0.0 func set_new_scene(scene): - current_scene.queue_free() var instance = scene.instance() instance.connect("loaded", self, "_fade_out") root.add_child(instance) root.move_child(instance, 0) + get_tree().current_scene = instance + current_scene.queue_free() func _process(delta): if loader == null: diff --git a/Scenes/Lobby.gd b/Scenes/Lobby.gd new file mode 100644 index 0000000..e6964a9 --- /dev/null +++ b/Scenes/Lobby.gd @@ -0,0 +1,6 @@ +extends Control + +signal loaded() + +func _ready(): + emit_signal("loaded") \ No newline at end of file diff --git a/Scenes/Lobby.tscn b/Scenes/Lobby.tscn index 103ae42..78ac20f 100644 --- a/Scenes/Lobby.tscn +++ b/Scenes/Lobby.tscn @@ -1,14 +1,16 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=3 format=2] -[ext_resource path="res://MLPAssets/Background/menubg.webp" type="Texture" id=1] +[ext_resource path="res://Scenes/Lobby.gd" type="Script" id=1] +[ext_resource path="res://MLPAssets/Background/menubg.webp" type="Texture" id=2] [node name="Lobby" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 +script = ExtResource( 1 ) [node name="TextureRect" type="TextureRect" parent="."] anchor_right = 1.0 anchor_bottom = 1.0 -texture = ExtResource( 1 ) +texture = ExtResource( 2 ) expand = true stretch_mode = 7 diff --git a/Scenes/Scripts/SplashScreen.gd b/Scenes/Scripts/SplashScreen.gd index 08fa934..2cb117e 100644 --- a/Scenes/Scripts/SplashScreen.gd +++ b/Scenes/Scripts/SplashScreen.gd @@ -1,5 +1,14 @@ extends Control +var timeout = 1.0 + func _ready(): - #TODO Splash screen - Loader.load_scene("res://Scenes/Board.tscn") \ No newline at end of file + # Stupid hack for seamless transition + get_tree().get_root().call_deferred("move_child", self, 0) + + +func _process(delta): + timeout -= delta + if timeout <= 0: + Loader.load_scene("res://Scenes/Lobby.tscn") + set_process(false) \ No newline at end of file diff --git a/Scenes/SplashScreen.tscn b/Scenes/SplashScreen.tscn index d3fe5fe..6d248c2 100644 --- a/Scenes/SplashScreen.tscn +++ b/Scenes/SplashScreen.tscn @@ -1,8 +1,16 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=3 format=2] [ext_resource path="res://Scenes/Scripts/SplashScreen.gd" type="Script" id=1] +[ext_resource path="res://UIAssets/splash.png" type="Texture" id=2] [node name="Control" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 script = ExtResource( 1 ) + +[node name="TextureRect" type="TextureRect" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +texture = ExtResource( 2 ) +expand = true +stretch_mode = 6 diff --git a/UIAssets/splash.png b/UIAssets/splash.png new file mode 100644 index 0000000..93748bb Binary files /dev/null and b/UIAssets/splash.png differ diff --git a/UIAssets/splash.png.import b/UIAssets/splash.png.import new file mode 100644 index 0000000..a3af028 --- /dev/null +++ b/UIAssets/splash.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/splash.png-e50ae66ed178dbf3b831a31cf16b4033.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UIAssets/splash.png" +dest_files=[ "res://.import/splash.png-e50ae66ed178dbf3b831a31cf16b4033.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/project.godot b/project.godot index 5d0a19b..b044674 100644 --- a/project.godot +++ b/project.godot @@ -47,6 +47,7 @@ _global_script_class_icons={ config/name="MLP CARD GAME" run/main_scene="res://Scenes/SplashScreen.tscn" run/low_processor_mode=true +boot_splash/image="res://UIAssets/splash.png" boot_splash/bg_color=Color( 0.156863, 0.156863, 0.156863, 1 ) config/icon="res://icon.png"