add train control game

This commit is contained in:
Overside srl
2026-01-27 19:11:56 +01:00
parent 2af450ffc5
commit 8222c7613d
238 changed files with 1778 additions and 476 deletions

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://by7iywhy2d8uy"]
[gd_scene format=3 uid="uid://by7iywhy2d8uy"]
[ext_resource type="Script" uid="uid://s80bt8i6u2hv" path="res://scripts/gamestate.gd" id="1_ncx5y"]
[node name="GameState" type="Node"]
[node name="GameState" type="Node" unique_id=608737063]
script = ExtResource("1_ncx5y")

View File

@@ -1,172 +1,126 @@
[gd_scene load_steps=15 format=3 uid="uid://c8k7h4fvtqxqm"]
[gd_scene format=3 uid="uid://csm5ihvpyw5m7"]
[ext_resource type="Script" uid="uid://dfyo0h5yj3us8" path="res://scripts/main.gd" id="1_main"]
[ext_resource type="Script" uid="uid://bymoo78gun6a4" path="res://scripts/track_generator.gd" id="2_track"]
[ext_resource type="Script" uid="uid://cvn333pymsowx" path="res://scripts/train.gd" id="3_train"]
[ext_resource type="Script" uid="uid://cgy51h6a5syer" path="res://scripts/train_camera.gd" id="4_camera"]
[ext_resource type="PackedScene" uid="uid://cer3o7xlhju7v" path="res://scenes/train.tscn" id="5_tbgi4"]
[ext_resource type="PackedScene" uid="uid://qrf08uiuhyqg" path="res://scenes/musicmanager.tscn" id="6_tefeu"]
[ext_resource type="Texture2D" uid="uid://bi2atrvjj23tk" path="res://resources/audio_on.png" id="6_tipki"]
[ext_resource type="PackedScene" uid="uid://by7iywhy2d8uy" path="res://scenes/gamestate.tscn" id="7_o6xl0"]
[ext_resource type="Texture2D" uid="uid://n6bjl02ikh00" path="res://resources/audio_off.png" id="8_85g3d"]
[ext_resource type="Script" uid="uid://cfjaa6hq1wpvd" path="res://scripts/main.gd" id="1_main"]
[sub_resource type="LabelSettings" id="LabelSettings_tbgi4"]
font_color = Color(0, 0, 0, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_sgp6g"]
bg_color = Color(0.97496897, 0.9929336, 1, 1)
corner_radius_top_left = 16
corner_radius_top_right = 16
corner_radius_bottom_right = 16
corner_radius_bottom_left = 16
shadow_size = 3
[sub_resource type="LabelSettings" id="LabelSettings_tefeu"]
font_color = Color(0, 0, 0, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_o5qli"]
bg_color = Color(0.97496897, 0.9929336, 1, 1)
corner_radius_top_left = 16
corner_radius_top_right = 16
corner_radius_bottom_right = 16
corner_radius_bottom_left = 16
shadow_size = 3
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_tefeu"]
sky_top_color = Color(0.6262097, 0.76737565, 0.9309246, 1)
sky_horizon_color = Color(0.82665706, 0.8808251, 0.95468724, 1)
ground_bottom_color = Color(0.5370987, 0.48452926, 0.42358288, 1)
ground_horizon_color = Color(0.7014107, 0.735357, 0.7014107, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0wfyh"]
bg_color = Color(0.97496897, 0.9929336, 1, 1)
corner_radius_top_left = 16
corner_radius_top_right = 16
corner_radius_bottom_right = 16
corner_radius_bottom_left = 16
shadow_size = 3
[sub_resource type="Sky" id="Sky_o6xl0"]
sky_material = SubResource("ProceduralSkyMaterial_tefeu")
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_o5qli"]
[sub_resource type="Environment" id="Environment_tipki"]
background_mode = 2
sky = SubResource("Sky_o6xl0")
ambient_light_source = 3
ambient_light_energy = 0.6
tonemap_mode = 3
fog_enabled = true
fog_light_color = Color(0.85430586, 0.8808251, 0.9063318, 1)
fog_density = 0.0015
[node name="Main" type="Node3D"]
[node name="Main" type="Control" unique_id=1436180697]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_main")
[node name="TrackGenerator" type="Node3D" parent="."]
script = ExtResource("2_track")
track_width = 1.0
sleeper_width = 1.5
segments_behind = 7
[node name="Panel" type="Panel" parent="." unique_id=1434712397]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Train" parent="." instance=ExtResource("5_tbgi4")]
script = ExtResource("3_train")
wagon_spacing = 2.65
[node name="VBoxContainer" type="VBoxContainer" parent="." unique_id=616480461]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -150.5
offset_top = -126.0
offset_right = 150.5
offset_bottom = 126.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 10
[node name="TrainCamera" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 10, 20)
current = true
fov = 60.0
script = ExtResource("4_camera")
follow_distance = 20.0
follow_height = 8.0
[node name="TrainJourney" type="Button" parent="VBoxContainer" unique_id=748071748]
layout_mode = 2
size_flags_vertical = 3
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_colors/font_pressed_color = Color(0, 0, 0, 1)
theme_override_colors/font_hover_color = Color(0, 0, 0, 1)
theme_override_colors/font_hover_pressed_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 30
theme_override_styles/normal = SubResource("StyleBoxFlat_sgp6g")
theme_override_styles/pressed = SubResource("StyleBoxFlat_o5qli")
theme_override_styles/hover = SubResource("StyleBoxFlat_0wfyh")
theme_override_styles/focus = SubResource("StyleBoxEmpty_o5qli")
text = "Train Journey"
[node name="HUD" type="Control" parent="."]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="TrainControl" type="Button" parent="VBoxContainer" unique_id=516792886]
layout_mode = 2
size_flags_vertical = 3
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_colors/font_pressed_color = Color(0, 0, 0, 1)
theme_override_colors/font_hover_color = Color(0, 0, 0, 1)
theme_override_colors/font_hover_pressed_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 30
theme_override_styles/normal = SubResource("StyleBoxFlat_sgp6g")
theme_override_styles/pressed = SubResource("StyleBoxFlat_o5qli")
theme_override_styles/hover = SubResource("StyleBoxFlat_0wfyh")
theme_override_styles/focus = SubResource("StyleBoxEmpty_o5qli")
text = "Train Control"
[node name="tripdistance_label" type="Label" parent="HUD"]
layout_mode = 0
offset_left = 20.0
offset_top = 44.0
offset_right = 1280.0
offset_bottom = 67.0
size_flags_vertical = 0
text = "Distanza viaggio: 0"
label_settings = SubResource("LabelSettings_tbgi4")
[node name="Exit" type="Button" parent="VBoxContainer" unique_id=1837330634]
layout_mode = 2
size_flags_vertical = 3
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_colors/font_pressed_color = Color(0, 0, 0, 1)
theme_override_colors/font_hover_color = Color(0, 0, 0, 1)
theme_override_colors/font_hover_pressed_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 30
theme_override_styles/normal = SubResource("StyleBoxFlat_sgp6g")
theme_override_styles/pressed = SubResource("StyleBoxFlat_o5qli")
theme_override_styles/hover = SubResource("StyleBoxFlat_0wfyh")
theme_override_styles/focus = SubResource("StyleBoxEmpty_o5qli")
text = "Exit"
[node name="speed_label" type="Label" parent="HUD"]
layout_mode = 0
offset_left = 20.0
offset_top = 20.0
offset_right = 1280.0
offset_bottom = 43.0
size_flags_vertical = 0
text = "Velocità: 0"
label_settings = SubResource("LabelSettings_tefeu")
[node name="Label" type="Label" parent="." unique_id=1191738199]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -104.5
offset_top = -224.0
offset_right = 104.5
offset_bottom = -157.0
grow_horizontal = 2
grow_vertical = 2
theme_override_colors/font_shadow_color = Color(0, 0, 0, 0)
theme_override_font_sizes/font_size = 48
text = "TRINITTU"
horizontal_alignment = 1
vertical_alignment = 1
[node name="camera_label" type="Label" parent="HUD"]
layout_mode = 0
offset_left = 20.0
offset_top = 149.0
offset_right = 1280.0
offset_bottom = 172.0
size_flags_vertical = 0
text = "Camera: "
label_settings = SubResource("LabelSettings_tefeu")
[node name="controls_label" type="Label" parent="HUD"]
layout_mode = 0
offset_left = 20.0
offset_top = 170.0
offset_right = 1280.0
offset_bottom = 297.0
size_flags_vertical = 0
text = "Comandi:
\"W / S - Accelera / Rallenta\",
\"A / D - Ruota camera\",
\"SPACE - Cambia camera\",
\"TAB - Cambia treno\",
\"ESC - Esci\""
label_settings = SubResource("LabelSettings_tefeu")
[node name="totaldistance_label" type="Label" parent="HUD"]
layout_mode = 0
offset_left = 20.0
offset_top = 68.0
offset_right = 1280.0
offset_bottom = 91.0
size_flags_vertical = 0
text = "Distanza totale: 0"
label_settings = SubResource("LabelSettings_tbgi4")
[node name="audio_button" type="Button" parent="HUD"]
layout_mode = 0
offset_left = 6.0
offset_top = 678.0
offset_right = 181.0
offset_bottom = 854.0
scale = Vector2(0.2, 0.2)
icon = ExtResource("6_tipki")
flat = true
[node name="triptime_label" type="Label" parent="HUD"]
layout_mode = 0
offset_left = 19.0
offset_top = 94.0
offset_right = 1279.0
offset_bottom = 117.0
size_flags_vertical = 0
text = "Tempo viaggio: 0"
label_settings = SubResource("LabelSettings_tbgi4")
[node name="totaltime_label" type="Label" parent="HUD"]
layout_mode = 0
offset_left = 19.0
offset_top = 117.0
offset_right = 1279.0
offset_bottom = 140.0
size_flags_vertical = 0
text = "Tempo totale: 0"
label_settings = SubResource("LabelSettings_tbgi4")
[node name="MusicManager" parent="." instance=ExtResource("6_tefeu")]
icon_active = ExtResource("6_tipki")
icon_inactive = ExtResource("8_85g3d")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
light_energy = 1.3
shadow_enabled = true
shadow_bias = 0.04
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_tipki")
[node name="GameState" parent="." groups=["save_data"] instance=ExtResource("7_o6xl0")]
[node name="AutoSaveTimer" type="Timer" parent="."]
wait_time = 10.0
[node name="TripTime" type="Timer" parent="."]
autostart = true
[connection signal="pressed" from="HUD/audio_button" to="MusicManager" method="_on_audio_button_pressed"]
[connection signal="timeout" from="AutoSaveTimer" to="." method="_on_timer_timeout"]
[connection signal="timeout" from="TripTime" to="." method="_on_trip_time_timeout"]
[connection signal="pressed" from="VBoxContainer/TrainJourney" to="." method="_on_train_journey_pressed"]
[connection signal="pressed" from="VBoxContainer/TrainControl" to="." method="_on_train_control_pressed"]
[connection signal="pressed" from="VBoxContainer/Exit" to="." method="_on_exit_pressed"]

View File

@@ -0,0 +1,126 @@
[gd_scene format=3 uid="uid://csm5ihvpyw5m7"]
[ext_resource type="Script" uid="uid://cfjaa6hq1wpvd" path="res://scripts/main.gd" id="1_main"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_sgp6g"]
bg_color = Color(0.97496897, 0.9929336, 1, 1)
corner_radius_top_left = 16
corner_radius_top_right = 16
corner_radius_bottom_right = 16
corner_radius_bottom_left = 16
shadow_size = 3
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_o5qli"]
bg_color = Color(0.97496897, 0.9929336, 1, 1)
corner_radius_top_left = 16
corner_radius_top_right = 16
corner_radius_bottom_right = 16
corner_radius_bottom_left = 16
shadow_size = 3
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0wfyh"]
bg_color = Color(0.97496897, 0.9929336, 1, 1)
corner_radius_top_left = 16
corner_radius_top_right = 16
corner_radius_bottom_right = 16
corner_radius_bottom_left = 16
shadow_size = 3
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_o5qli"]
[node name="Main" type="Control" unique_id=1436180697]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_main")
[node name="Panel" type="Panel" parent="." unique_id=1434712397]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="." unique_id=616480461]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -150.5
offset_top = -126.0
offset_right = 150.5
offset_bottom = 126.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 10
[node name="TrainJourney" type="Button" parent="VBoxContainer" unique_id=748071748]
layout_mode = 2
size_flags_vertical = 3
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_colors/font_pressed_color = Color(0, 0, 0, 1)
theme_override_colors/font_hover_color = Color(0, 0, 0, 1)
theme_override_colors/font_hover_pressed_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 30
theme_override_styles/normal = SubResource("StyleBoxFlat_sgp6g")
theme_override_styles/pressed = SubResource("StyleBoxFlat_o5qli")
theme_override_styles/hover = SubResource("StyleBoxFlat_0wfyh")
theme_override_styles/focus = SubResource("StyleBoxEmpty_o5qli")
text = "Train Journey"
[node name="TrainControl" type="Button" parent="VBoxContainer" unique_id=516792886]
layout_mode = 2
size_flags_vertical = 3
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_colors/font_pressed_color = Color(0, 0, 0, 1)
theme_override_colors/font_hover_color = Color(0, 0, 0, 1)
theme_override_colors/font_hover_pressed_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 30
theme_override_styles/normal = SubResource("StyleBoxFlat_sgp6g")
theme_override_styles/pressed = SubResource("StyleBoxFlat_o5qli")
theme_override_styles/hover = SubResource("StyleBoxFlat_0wfyh")
theme_override_styles/focus = SubResource("StyleBoxEmpty_o5qli")
text = "Train Control"
[node name="Exit" type="Button" parent="VBoxContainer" unique_id=1837330634]
layout_mode = 2
size_flags_vertical = 3
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_colors/font_pressed_color = Color(0, 0, 0, 1)
theme_override_colors/font_hover_color = Color(0, 0, 0, 1)
theme_override_colors/font_hover_pressed_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 30
theme_override_styles/normal = SubResource("StyleBoxFlat_sgp6g")
theme_override_styles/pressed = SubResource("StyleBoxFlat_o5qli")
theme_override_styles/hover = SubResource("StyleBoxFlat_0wfyh")
theme_override_styles/focus = SubResource("StyleBoxEmpty_o5qli")
text = "Exit"
[node name="Label" type="Label" parent="." unique_id=1191738199]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -104.5
offset_top = -224.0
offset_right = 104.5
offset_bottom = -157.0
grow_horizontal = 2
grow_vertical = 2
theme_override_colors/font_shadow_color = Color(0, 0, 0, 0)
theme_override_font_sizes/font_size = 48
text = "TRINITTU"
horizontal_alignment = 1
vertical_alignment = 1
[connection signal="pressed" from="VBoxContainer/TrainJourney" to="." method="_on_train_journey_pressed"]
[connection signal="pressed" from="VBoxContainer/TrainControl" to="." method="_on_train_control_pressed"]
[connection signal="pressed" from="VBoxContainer/Exit" to="." method="_on_exit_pressed"]

View File

@@ -1,40 +0,0 @@
[gd_scene load_steps=6 format=3 uid="uid://c8k7h4fvtqxqm"]
[ext_resource type="Script" uid="uid://dfyo0h5yj3us8" path="res://scripts/main.gd" id="1_main"]
[ext_resource type="Script" uid="uid://bymoo78gun6a4" path="res://scripts/track_generator.gd" id="2_track"]
[ext_resource type="Script" uid="uid://cvn333pymsowx" path="res://scripts/train.gd" id="3_train"]
[ext_resource type="Script" uid="uid://cgy51h6a5syer" path="res://scripts/train_camera.gd" id="4_camera"]
[ext_resource type="PackedScene" uid="uid://cer3o7xlhju7v" path="res://scenes/train.tscn" id="5_tbgi4"]
[node name="Main" type="Node3D"]
script = ExtResource("1_main")
[node name="TrackGenerator" type="Node3D" parent="."]
script = ExtResource("2_track")
segment_length = 10.0
min_curve_radius = 15.0
max_curve_radius = 30.0
max_curve_angle = 90.0
straight_probability = 0.6
segments_ahead = 10
segments_behind = 3
[node name="Train" parent="." instance=ExtResource("5_tbgi4")]
script = ExtResource("3_train")
locomotive_path = NodePath(".")
base_speed = null
max_speed = null
min_speed = null
acceleration = null
wagon_spacing = null
num_wagons = null
[node name="TrainCamera" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 10, 20)
current = true
fov = 60.0
script = ExtResource("4_camera")
follow_distance = 20.0
follow_height = 8.0
[node name="UI" type="CanvasLayer" parent="."]

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=3 format=3 uid="uid://qrf08uiuhyqg"]
[gd_scene format=3 uid="uid://qrf08uiuhyqg"]
[ext_resource type="AudioStream" uid="uid://bdluyy5uodjb5" path="res://resources/thomastanks_new.mp3" id="1_ht1d5"]
@@ -33,10 +33,10 @@ func _on_audio_button_pressed() -> void:
play_track()
"
[node name="MusicManager" type="Node"]
[node name="MusicManager" type="Node" unique_id=1072287338]
script = SubResource("GDScript_ht1d5")
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="." unique_id=281982184]
stream = ExtResource("1_ht1d5")
volume_db = -5.0
autoplay = true

View File

@@ -1,4 +1,4 @@
[gd_scene format=3 uid="uid://cer3o7xlhju7v"]
[node name="Train" type="Node3D"]
[node name="Train" type="Node3D" unique_id=1846344631]
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 0, 0, 0)

179
scenes/train_control.tscn Normal file
View File

@@ -0,0 +1,179 @@
[gd_scene format=3 uid="uid://dg1b7t2vssf3f"]
[ext_resource type="Script" uid="uid://ckndmko4orxx" path="res://scripts/traincontrol.gd" id="1_amtmp"]
[ext_resource type="Texture2D" uid="uid://bg24v3kb5e73l" path="res://resources/rail2.png" id="1_ihlg3"]
[ext_resource type="PackedScene" uid="uid://csm5ihvpyw5m7" path="res://scenes/main.tscn" id="2_0b1nv"]
[ext_resource type="Script" uid="uid://ck4j0pekoofm1" path="res://scripts/engine.gd" id="2_jgp6u"]
[ext_resource type="ArrayMesh" uid="uid://cm8un80nubjbi" path="res://resources/train kit/train-diesel-a.obj" id="3_jy5c4"]
[ext_resource type="Script" uid="uid://b65vwus8xxmun" path="res://scripts/traincontrol_camera.gd" id="4_jy5c4"]
[ext_resource type="Script" uid="uid://df2oi5vyeak81" path="res://scripts/train_movement.gd" id="6_1lqs8"]
[sub_resource type="PlaneMesh" id="PlaneMesh_23vqf"]
size = Vector2(100, 100)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_23vqf"]
albedo_color = Color(2.153851e-06, 0.25305444, 0.03645257, 1)
[sub_resource type="Curve3D" id="Curve3D_0b1nv"]
closed = true
_data = {
"points": PackedVector3Array(0, 0, 0, 0, 0, 0, -41.962486, 0.03566742, -44.78871, 0, 0, 0, 0, 0, 0, -7.760188, 0.036315918, -45.60305, 0, 0, 0, 0, 0, 0, 21.603975, 0.03604126, -45.26774, 0, 0, 0, 0, 0, 0, 41.148148, 0.03127289, -39.27994, 0, 0, 0, 0, 0, 0, 44.2618, 0.02154541, -27.064838, 0, 0, 0, 0, 0, 0, 44.118095, 0.0033874512, -4.2633114, 0, 0, 0, 0, 0, 0, 26.96904, 0.003112793, -3.9279928, 0, 0, 0, 0, 0, 0, 3.4968712, 0.0079574585, -10.011598, 0, 0, 0, 0, 0, 0, -3.8321874, 0.024543762, -30.849133, 0, 0, 0, 0, 0, 0, -25.627771, 0.026069641, -32.765224, 0, 0, 0, 0, 0, 0, -31.28027, 0.015075684, -18.969343, 0, 0, 0, 0, 0, 0, -23.472174, 0.003479004, -4.4070177, 0, 0, 0, 0, 0, 0, 12.167218, -0.011207581, 14.035401, 0, 0, 0, 0, 0, 0, 34.681347, -0.013763428, 17.244862, 0, 0, 0, 0, 0, 0, 46.99225, -0.019981384, 25.052942, 0, 0, 0, 0, 0, 0, 42.72894, -0.03504944, 43.97439, 0, 0, 0, 0, 0, 0, 14.897652, -0.036231995, 45.459354, 0, 0, 0, 0, 0, 0, -23.088955, -0.034858704, 43.73488, 0, 0, 0, 0, 0, 0, -44.357616, -0.034965515, 43.878586, 0, 0, 0, 0, 0, 0, -45.603073, -0.010246277, 12.837832, 0, 0, 0, 0, 0, 0, -34.585533, 0.0079422, -10.0116005, 0, 0, 0, 0, 0, 0, -38.321926, 0.022087097, -27.78338),
"tilts": PackedFloat32Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
}
point_count = 22
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ke0jj"]
albedo_texture = ExtResource("1_ihlg3")
uv1_scale = Vector3(0.235, -4.785, 1)
uv1_offset = Vector3(0, -0.61, 0)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ihlg3"]
metallic = 1.0
roughness = 0.25
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_jgp6u"]
sky_top_color = Color(0.6262097, 0.76737565, 0.9309246, 1)
sky_horizon_color = Color(0.82665706, 0.8808251, 0.95468724, 1)
ground_bottom_color = Color(0.5370987, 0.48452926, 0.42358288, 1)
ground_horizon_color = Color(0.7014107, 0.735357, 0.7014107, 1)
[sub_resource type="Sky" id="Sky_o6xl0"]
sky_material = SubResource("ProceduralSkyMaterial_jgp6u")
[sub_resource type="Environment" id="Environment_jy5c4"]
background_mode = 2
background_energy_multiplier = 1.2
sky = SubResource("Sky_o6xl0")
ambient_light_source = 3
ambient_light_color = Color(0.32642248, 0.5324062, 1, 1)
ambient_light_energy = 0.6
tonemap_mode = 3
fog_enabled = true
fog_light_color = Color(0.42881075, 0.64639634, 0.94499296, 1)
fog_density = 0.0015
[sub_resource type="LabelSettings" id="LabelSettings_1lqs8"]
font_color = Color(0, 0, 0, 1)
[node name="TrainControl" type="Node3D" unique_id=840483686]
script = ExtResource("1_amtmp")
main_scene = ExtResource("2_0b1nv")
[node name="Ground" type="MeshInstance3D" parent="." unique_id=263562811]
mesh = SubResource("PlaneMesh_23vqf")
surface_material_override/0 = SubResource("StandardMaterial3D_23vqf")
[node name="Rails" type="Path3D" parent="Ground" unique_id=1160818899]
curve = SubResource("Curve3D_0b1nv")
[node name="Ballast" type="CSGPolygon3D" parent="Ground/Rails" unique_id=259312931]
polygon = PackedVector2Array(-1, 0, -1, 0.1, 1, 0.1, 1, 0)
mode = 2
path_node = NodePath("..")
path_interval_type = 0
path_interval = 1.0
path_simplify_angle = 0.0
path_rotation = 2
path_rotation_accurate = false
path_local = false
path_continuous_u = true
path_u_distance = 1.0
path_joined = true
material = SubResource("StandardMaterial3D_ke0jj")
[node name="LRail" type="CSGPolygon3D" parent="Ground/Rails" unique_id=477776682]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.24889, -4.7985353, 2.2341003)
polygon = PackedVector2Array(-0.5, 0, -0.5, 0.2, -0.4, 0.2, -0.4, 0)
mode = 2
path_node = NodePath("..")
path_interval_type = 0
path_interval = 1.0
path_simplify_angle = 0.0
path_rotation = 2
path_rotation_accurate = false
path_local = false
path_continuous_u = true
path_u_distance = 1.0
path_joined = true
material = SubResource("StandardMaterial3D_ihlg3")
[node name="RRail" type="CSGPolygon3D" parent="Ground/Rails" unique_id=965437995]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.24889, -4.7985353, 2.2341003)
polygon = PackedVector2Array(0.5, 0, 0.5, 0.2, 0.4, 0.2, 0.5, 0)
mode = 2
path_node = NodePath("..")
path_interval_type = 0
path_interval = 1.0
path_simplify_angle = 0.0
path_rotation = 2
path_rotation_accurate = false
path_local = false
path_continuous_u = true
path_u_distance = 1.0
path_joined = true
material = SubResource("StandardMaterial3D_ihlg3")
[node name="TrainEngine" type="PathFollow3D" parent="Ground/Rails" unique_id=973990755]
transform = Transform3D(0.026897233, -2.1416474e-05, -1.1296921, 0, 1.130161, -2.141972e-05, 1.1296905, 5.0991304e-07, 0.02689727, -41.962486, 0.03566742, -44.78871)
rotation_mode = 4
script = ExtResource("2_jgp6u")
[node name="Train" type="MeshInstance3D" parent="Ground/Rails/TrainEngine" unique_id=65189673]
mesh = ExtResource("3_jy5c4")
script = ExtResource("6_1lqs8")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=1729725358]
shadow_enabled = true
shadow_bias = 0.04
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=431838059]
environment = SubResource("Environment_jy5c4")
[node name="TrainCamera" type="Camera3D" parent="." unique_id=188013126 node_paths=PackedStringArray("train")]
transform = Transform3D(0.30358428, -0.00013030751, -0.95280457, 0, 1, -0.00013676206, 0.95280457, 4.151881e-05, 0.30358428, 18.173706, 3.0913553, 48.05532)
current = true
fov = 11.9
near = 0.001
script = ExtResource("4_jy5c4")
train = NodePath("../Ground/Rails/TrainEngine/Train")
[node name="HUD" type="Control" parent="." unique_id=563257159]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="speed_label" type="Label" parent="HUD" unique_id=1564808190]
layout_mode = 0
offset_left = 20.0
offset_top = 20.0
offset_right = 1280.0
offset_bottom = 43.0
size_flags_vertical = 0
text = "Velocità: 0"
label_settings = SubResource("LabelSettings_1lqs8")
[node name="camera_label" type="Label" parent="HUD" unique_id=1719494020]
layout_mode = 0
offset_left = 20.0
offset_top = 43.0
offset_right = 1280.0
offset_bottom = 66.0
size_flags_vertical = 0
text = "Camera: "
label_settings = SubResource("LabelSettings_1lqs8")
[node name="controls_label" type="Label" parent="HUD" unique_id=1262113688]
layout_mode = 0
offset_left = 20.0
offset_top = 64.0
offset_right = 1280.0
offset_bottom = 217.0
size_flags_vertical = 0
text = "Comandi:
\"W / S - Accelera / Rallenta\",
\"A / D - Ruota camera\",
\"SPACE - Cambia camera\",
\"TAB - Cambia treno\",
\"ESC - Esci\""
label_settings = SubResource("LabelSettings_1lqs8")

174
scenes/trainjourney.tscn Normal file
View File

@@ -0,0 +1,174 @@
[gd_scene format=3 uid="uid://c8k7h4fvtqxqm"]
[ext_resource type="Script" uid="uid://dfyo0h5yj3us8" path="res://scripts/trainjourney.gd" id="1_0nial"]
[ext_resource type="PackedScene" uid="uid://csm5ihvpyw5m7" path="res://scenes/main.tscn" id="2_7fone"]
[ext_resource type="Script" uid="uid://bymoo78gun6a4" path="res://scripts/track_generator.gd" id="2_j07ug"]
[ext_resource type="PackedScene" uid="uid://cer3o7xlhju7v" path="res://scenes/train.tscn" id="3_7fone"]
[ext_resource type="Script" uid="uid://cvn333pymsowx" path="res://scripts/train.gd" id="4_7brvr"]
[ext_resource type="Script" uid="uid://cgy51h6a5syer" path="res://scripts/trainjourney_camera.gd" id="5_4toc1"]
[ext_resource type="Texture2D" uid="uid://bi2atrvjj23tk" path="res://resources/audio_on.png" id="6_bapl2"]
[ext_resource type="PackedScene" uid="uid://qrf08uiuhyqg" path="res://scenes/musicmanager.tscn" id="7_ilqki"]
[ext_resource type="Texture2D" uid="uid://n6bjl02ikh00" path="res://resources/audio_off.png" id="8_k6j2o"]
[ext_resource type="PackedScene" uid="uid://by7iywhy2d8uy" path="res://scenes/gamestate.tscn" id="9_nwfv8"]
[sub_resource type="LabelSettings" id="LabelSettings_tbgi4"]
font_color = Color(0, 0, 0, 1)
[sub_resource type="LabelSettings" id="LabelSettings_tefeu"]
font_color = Color(0, 0, 0, 1)
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_tefeu"]
sky_top_color = Color(0.6262097, 0.76737565, 0.9309246, 1)
sky_horizon_color = Color(0.82665706, 0.8808251, 0.95468724, 1)
ground_bottom_color = Color(0.5370987, 0.48452926, 0.42358288, 1)
ground_horizon_color = Color(0.7014107, 0.735357, 0.7014107, 1)
[sub_resource type="Sky" id="Sky_0nial"]
sky_material = SubResource("ProceduralSkyMaterial_tefeu")
[sub_resource type="Environment" id="Environment_tipki"]
background_mode = 2
sky = SubResource("Sky_0nial")
ambient_light_source = 3
ambient_light_energy = 0.6
tonemap_mode = 3
fog_enabled = true
fog_light_color = Color(0.85430586, 0.8808251, 0.9063318, 1)
fog_density = 0.0015
[node name="TrainJourney" type="Node3D" unique_id=1963280672]
script = ExtResource("1_0nial")
main_scene = ExtResource("2_7fone")
[node name="TrackGenerator" type="Node3D" parent="." unique_id=1804102656]
script = ExtResource("2_j07ug")
track_width = 1.0
sleeper_width = 1.5
segments_behind = 7
[node name="Train" parent="." unique_id=1314026371 instance=ExtResource("3_7fone")]
script = ExtResource("4_7brvr")
wagon_spacing = 2.65
[node name="TrainCamera" type="Camera3D" parent="." unique_id=1701124966]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 10, 20)
current = true
fov = 60.0
script = ExtResource("5_4toc1")
follow_distance = 20.0
follow_height = 8.0
[node name="HUD" type="Control" parent="." unique_id=833826261]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="tripdistance_label" type="Label" parent="HUD" unique_id=1839637385]
layout_mode = 0
offset_left = 20.0
offset_top = 44.0
offset_right = 1280.0
offset_bottom = 67.0
size_flags_vertical = 0
text = "Distanza viaggio: 0"
label_settings = SubResource("LabelSettings_tbgi4")
[node name="speed_label" type="Label" parent="HUD" unique_id=122503890]
layout_mode = 0
offset_left = 20.0
offset_top = 20.0
offset_right = 1280.0
offset_bottom = 43.0
size_flags_vertical = 0
text = "Velocità: 0"
label_settings = SubResource("LabelSettings_tefeu")
[node name="camera_label" type="Label" parent="HUD" unique_id=83899204]
layout_mode = 0
offset_left = 20.0
offset_top = 149.0
offset_right = 1280.0
offset_bottom = 172.0
size_flags_vertical = 0
text = "Camera: "
label_settings = SubResource("LabelSettings_tefeu")
[node name="controls_label" type="Label" parent="HUD" unique_id=1666328438]
layout_mode = 0
offset_left = 20.0
offset_top = 170.0
offset_right = 1280.0
offset_bottom = 297.0
size_flags_vertical = 0
text = "Comandi:
\"W / S - Accelera / Rallenta\",
\"A / D - Ruota camera\",
\"SPACE - Cambia camera\",
\"TAB - Cambia treno\",
\"ESC - Esci\""
label_settings = SubResource("LabelSettings_tefeu")
[node name="totaldistance_label" type="Label" parent="HUD" unique_id=544099778]
layout_mode = 0
offset_left = 20.0
offset_top = 68.0
offset_right = 1280.0
offset_bottom = 91.0
size_flags_vertical = 0
text = "Distanza totale: 0"
label_settings = SubResource("LabelSettings_tbgi4")
[node name="audio_button" type="Button" parent="HUD" unique_id=770880228]
layout_mode = 0
offset_left = 6.0
offset_top = 678.0
offset_right = 181.0
offset_bottom = 854.0
scale = Vector2(0.2, 0.2)
icon = ExtResource("6_bapl2")
flat = true
[node name="triptime_label" type="Label" parent="HUD" unique_id=61311648]
layout_mode = 0
offset_left = 19.0
offset_top = 94.0
offset_right = 1279.0
offset_bottom = 117.0
size_flags_vertical = 0
text = "Tempo viaggio: 0"
label_settings = SubResource("LabelSettings_tbgi4")
[node name="totaltime_label" type="Label" parent="HUD" unique_id=2138643407]
layout_mode = 0
offset_left = 19.0
offset_top = 117.0
offset_right = 1279.0
offset_bottom = 140.0
size_flags_vertical = 0
text = "Tempo totale: 0"
label_settings = SubResource("LabelSettings_tbgi4")
[node name="MusicManager" parent="." unique_id=445447211 instance=ExtResource("7_ilqki")]
icon_active = ExtResource("6_bapl2")
icon_inactive = ExtResource("8_k6j2o")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=1793402357]
light_energy = 1.3
shadow_enabled = true
shadow_bias = 0.04
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1578392535]
environment = SubResource("Environment_tipki")
[node name="GameState" parent="." unique_id=278367250 groups=["save_data"] instance=ExtResource("9_nwfv8")]
[node name="AutoSaveTimer" type="Timer" parent="." unique_id=2087834857]
wait_time = 10.0
[node name="TripTime" type="Timer" parent="." unique_id=599791207]
autostart = true
[connection signal="pressed" from="HUD/audio_button" to="MusicManager" method="_on_audio_button_pressed"]
[connection signal="timeout" from="AutoSaveTimer" to="." method="_on_timer_timeout"]
[connection signal="timeout" from="TripTime" to="." method="_on_trip_time_timeout"]