Moves stuff around, made a main menu and scene mgr

This commit is contained in:
Dan Baker 2025-07-03 14:08:39 +01:00
parent b2e3a3957b
commit 6c023a60a6
37 changed files with 888 additions and 214 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,14 @@
[gd_scene load_steps=4 format=3 uid="uid://cn41yepyhvwsd"]
[ext_resource type="Script" uid="uid://bqtnrs6cjoyj6" path="res://Stages/SceneManager/scripts/scene_manager.gd" id="1_scgkw"]
[ext_resource type="PackedScene" uid="uid://bon4rtm4rv1rf" path="res://Stages/SceneManager/TransitionScene.tscn" id="2_fe7gw"]
[ext_resource type="PackedScene" uid="uid://dkucysn167kp6" path="res://Stages/MainMenu/MainMenu.tscn" id="3_obg8q"]
[node name="SceneManager" type="Node3D"]
script = ExtResource("1_scgkw")
[node name="CurrentScene" type="Node" parent="."]
[node name="MainMenu" parent="CurrentScene" instance=ExtResource("3_obg8q")]
[node name="TransitionScene" parent="." instance=ExtResource("2_fe7gw")]

View file

@ -0,0 +1,76 @@
[gd_scene load_steps=6 format=3 uid="uid://bon4rtm4rv1rf"]
[ext_resource type="Script" uid="uid://cem1lps8uxlya" path="res://Stages/SceneManager/scripts/transition_scene.gd" id="1_pt42a"]
[sub_resource type="Animation" id="Animation_skyqd"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("ColorRect:color")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(0, 0, 0, 1)]
}
[sub_resource type="Animation" id="Animation_ehfi2"]
resource_name = "fade_to_black"
length = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("ColorRect:color")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(0, 0, 0, 0), Color(0, 0, 0, 1)]
}
[sub_resource type="Animation" id="Animation_n8kpy"]
resource_name = "fade_to_normal"
length = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("ColorRect:color")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(0, 0, 0, 1), Color(0, 0, 0, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_lyb8n"]
_data = {
&"RESET": SubResource("Animation_skyqd"),
&"fade_to_black": SubResource("Animation_ehfi2"),
&"fade_to_normal": SubResource("Animation_n8kpy")
}
[node name="TransitionScene" type="CanvasLayer"]
script = ExtResource("1_pt42a")
[node name="ColorRect" type="ColorRect" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
color = Color(0, 0, 0, 1)
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
&"": SubResource("AnimationLibrary_lyb8n")
}
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_animation_player_animation_finished"]

View file

@ -0,0 +1,32 @@
extends Node3D
class_name SceneManager
const SCENES: Dictionary = {
"MAINMENU": "res://Stages/MainMenu/MainMenu.tscn",
"HIGHSCORES": "res://scenes/high_scores.tscn"
}
var loading_scene_res: Resource = null
func _ready() -> void:
## LOAD GAME DATA
#HighScoreMgr.load()
#HighScoreMgr.debug_output()
# HighScoreMgr.debug_save_high_score()
Log.pr("SceneManager is ready.")
SceneMgr.connect("change_scene", Callable(self, "_on_change_scene"))
$TransitionScene.connect("transitioned", Callable(self, "_on_transition_scene_transitioned"))
func _on_change_scene(scene_name: String) -> void:
Log.pr("Going to load a scene.", scene_name)
if SCENES.has(scene_name):
#GameState.reset()
loading_scene_res = load(SCENES[scene_name])
Log.pr("Loading scene: ", loading_scene_res)
$TransitionScene.transition()
else:
loading_scene_res = null
func _on_transition_scene_transitioned() -> void:
$CurrentScene.get_child(0).queue_free()
$CurrentScene.add_child(loading_scene_res.instantiate())

View file

@ -0,0 +1 @@
uid://bqtnrs6cjoyj6

View file

@ -0,0 +1,18 @@
extends CanvasLayer
signal transitioned
func _ready() -> void:
$AnimationPlayer.play("fade_to_normal")
func transition() -> void:
$AnimationPlayer.play("fade_to_black")
Log.pr("Fading to black")
func _on_animation_player_animation_finished(anim_name: StringName) -> void:
if anim_name == "fade_to_black":
Log.pr("Sending transitioned signal...")
emit_signal("transitioned")
$AnimationPlayer.play("fade_to_normal")
if anim_name == "fade_to_normal":
Log.pr("Faded to normal")

View file

@ -0,0 +1 @@
uid://cem1lps8uxlya

View file

@ -1,6 +1,6 @@
[gd_resource type="ShaderMaterial" load_steps=4 format=3 uid="uid://b1miqvl8lus75"]
[ext_resource type="Shader" uid="uid://dbduq0qcaxmyi" path="res://grass.gdshader" id="1_vnnwo"]
[ext_resource type="Shader" uid="uid://dbduq0qcaxmyi" path="res://Common/shaders/grass.gdshader" id="1_vnnwo"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_vnnwo"]

View file

@ -4,7 +4,7 @@
[ext_resource type="Texture2D" uid="uid://c6mugqvfn8ihk" path="res://addons/AllSkyFree/Skyboxes/AllSkyFree_Sky_ClearBlueSky_Equirect.png" id="1_fm6lr"]
[ext_resource type="AnimationLibrary" uid="uid://bwnn7vpd0dqds" path="res://Common/animations/basic-movement.res" id="1_tfa5t"]
[ext_resource type="Script" uid="uid://bbjv6a7yg7m02" path="res://Stages/Test3D/camera_pivot.gd" id="2_sdmks"]
[ext_resource type="Shader" uid="uid://bsemnmdracd4m" path="res://Common/shaders/outline.gdshader" id="4_feu7y"]
[ext_resource type="Shader" uid="uid://bsemnmdracd4m" path="res://Common/shaders/pixel_outline.gdshader" id="4_feu7y"]
[ext_resource type="Script" uid="uid://cjbk6jnxla4mn" path="res://Stages/Test3D/camera_3d.gd" id="5_fm6lr"]
[ext_resource type="PackedScene" uid="uid://isogcpkb8su4" path="res://Entities/Tree/assets/temp/tent_detailedOpen.glb" id="9_4jb6r"]
[ext_resource type="Script" uid="uid://bjco8musjqog4" path="res://Stages/Test3D/particles.gd" id="9_oiyue"]
@ -149,6 +149,13 @@ func _process(_delta):
radius = 0.2
height = 0.5
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_fm6lr"]
dof_blur_far_enabled = true
dof_blur_far_distance = 5.0
dof_blur_far_transition = 10.0
dof_blur_near_distance = 0.87
dof_blur_amount = 0.08
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_hbd03"]
resource_name = "shoes(Clone)mat"
cull_mode = 2
@ -475,13 +482,6 @@ material = SubResource("ShaderMaterial_tfa5t")
flip_faces = true
size = Vector2(2, 2)
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_fm6lr"]
dof_blur_far_enabled = true
dof_blur_far_distance = 5.0
dof_blur_far_transition = 10.0
dof_blur_near_distance = 0.87
dof_blur_amount = 0.08
[sub_resource type="BoxShape3D" id="BoxShape3D_tfa5t"]
size = Vector3(60, 0, 20)
@ -603,6 +603,14 @@ script = SubResource("GDScript_fm6lr")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.257867, 0)
shape = SubResource("CapsuleShape3D_tfa5t")
[node name="FirstPersonCamera" type="Camera3D" parent="SubViewportContainer/SubViewport/Player"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.359, -0.2)
attributes = SubResource("CameraAttributesPractical_fm6lr")
current = true
fov = 35.0
near = 0.103
far = 125.41
[node name="Pivot" type="Node3D" parent="SubViewportContainer/SubViewport/Player"]
[node name="Character" type="Node3D" parent="SubViewportContainer/SubViewport/Player/Pivot"]
@ -879,14 +887,6 @@ mesh = SubResource("QuadMesh_tfa5t")
[node name="RayCast3D" type="RayCast3D" parent="SubViewportContainer/SubViewport/Player/CameraPivot/Camera3D"]
collision_mask = 3
[node name="FirstPersonCamera" type="Camera3D" parent="SubViewportContainer/SubViewport/Player"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.359, -0.2)
attributes = SubResource("CameraAttributesPractical_fm6lr")
current = true
fov = 35.0
near = 0.103
far = 125.41
[node name="Environment" type="Node3D" parent="SubViewportContainer/SubViewport"]
[node name="Ground" type="StaticBody3D" parent="SubViewportContainer/SubViewport/Environment"]
@ -937,7 +937,7 @@ draw_pass_1 = SubResource("QuadMesh_hvb1l")
[node name="OmniLight3D" type="OmniLight3D" parent="SubViewportContainer/SubViewport/Camp/Objects/Camp/Campfire/Fire"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.000509977, 0.121094, -0.00151992)
light_color = Color(0.89, 0.461613, 0.2136, 1)
light_energy = 0.816855
light_energy = 0.921402
light_indirect_energy = 1.084
light_volumetric_fog_energy = 3.764
light_size = 0.105
@ -967,6 +967,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.727, -0.05, 0.611)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.609, -0.05, 0.72)
[node name="VFX" type="Node3D" parent="SubViewportContainer/SubViewport/Camp"]
visible = false
[node name="Rain" type="GPUParticles3D" parent="SubViewportContainer/SubViewport/Camp/VFX"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.545105, 10.1451, 0.937134)