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,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"]