From b67de8d3df13bca5d7564693549e7954909e7a35 Mon Sep 17 00:00:00 2001 From: Willow Behar <2364126-TechRunner@users.noreply.gitlab.com> Date: Thu, 9 May 2024 11:53:33 -0500 Subject: [PATCH] Added Loading Screen for 1 second to just hide the player falling after spawning in --- Assets/components/player.tscn | 41 ++++++++++++++++++++++++++++++++- Assets/scripts/LoadingScreen.gd | 10 ++++++++ Assets/scripts/player.gd | 3 +++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 Assets/scripts/LoadingScreen.gd diff --git a/Assets/components/player.tscn b/Assets/components/player.tscn index 8845380..774483d 100644 --- a/Assets/components/player.tscn +++ b/Assets/components/player.tscn @@ -1,8 +1,10 @@ -[gd_scene load_steps=5 format=3 uid="uid://bcjijcf8br8t4"] +[gd_scene load_steps=7 format=3 uid="uid://bcjijcf8br8t4"] [ext_resource type="Script" path="res://Assets/scripts/player.gd" id="1_b2ij4"] [ext_resource type="Script" path="res://Assets/scripts/Head.gd" id="2_is0vo"] [ext_resource type="Script" path="res://Assets/components/vapelight.gd" id="2_ndvgb"] +[ext_resource type="Script" path="res://Assets/scripts/LoadingScreen.gd" id="4_1bb8i"] +[ext_resource type="Theme" uid="uid://bm7gkjfqwmc3i" path="res://Assets/main_menu_theme.tres" id="4_bb8iw"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_lm3xc"] @@ -42,7 +44,44 @@ wait_time = 5.0 [node name="Severe Coughing Recovery" type="Timer" parent="."] wait_time = 15.0 +[node name="LoadingScreen" type="Control" parent="."] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("4_1bb8i") + +[node name="Blackout" type="ColorRect" parent="LoadingScreen"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0, 0, 0, 1) + +[node name="RichTextLabel" type="RichTextLabel" parent="LoadingScreen/Blackout"] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -188.0 +offset_top = -57.0 +offset_right = 188.0 +offset_bottom = 57.0 +grow_horizontal = 2 +grow_vertical = 2 +theme = ExtResource("4_bb8iw") +text = "Loading..." + +[node name="Timer" type="Timer" parent="LoadingScreen"] + [connection signal="timeout" from="Severe Coughing Timer" to="." method="_on_severe_coughing_timer_timeout"] [connection signal="timeout" from="Coughing Timer" to="." method="_on_coughing_timer_timeout"] [connection signal="timeout" from="Coughing Recovery" to="." method="_on_coughing_recovery_timeout"] [connection signal="timeout" from="Severe Coughing Recovery" to="." method="_on_severe_coughing_recovery_timeout"] +[connection signal="timeout" from="LoadingScreen/Timer" to="LoadingScreen" method="_on_timer_timeout"] diff --git a/Assets/scripts/LoadingScreen.gd b/Assets/scripts/LoadingScreen.gd new file mode 100644 index 0000000..119a88f --- /dev/null +++ b/Assets/scripts/LoadingScreen.gd @@ -0,0 +1,10 @@ +extends Control + +func _init(): + show() + +func _ready(): + $Timer.start() + +func _on_timer_timeout(): + hide() diff --git a/Assets/scripts/player.gd b/Assets/scripts/player.gd index bc31801..0a37a17 100644 --- a/Assets/scripts/player.gd +++ b/Assets/scripts/player.gd @@ -37,6 +37,7 @@ const SPEED_SLOWED = 3.0 const SPEED_IMMOBILE = 0.0 const JUMP_VELOCITY = 4.5 + #Looking Variables var mouse_sensitivity = 0.02 var joystick_sensitity = 2 @@ -142,3 +143,5 @@ func _on_coughing_recovery_timeout(): func _on_severe_coughing_recovery_timeout(): recover() + +