Init
This commit is contained in:
6
scenes/gamestate.tscn
Normal file
6
scenes/gamestate.tscn
Normal file
@@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 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"]
|
||||
script = ExtResource("1_ncx5y")
|
||||
162
scenes/main.tscn
Normal file
162
scenes/main.tscn
Normal file
@@ -0,0 +1,162 @@
|
||||
[gd_scene load_steps=15 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"]
|
||||
[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"]
|
||||
|
||||
[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_o6xl0"]
|
||||
sky_material = SubResource("ProceduralSkyMaterial_tefeu")
|
||||
|
||||
[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"]
|
||||
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="Train" parent="." instance=ExtResource("5_tbgi4")]
|
||||
script = ExtResource("3_train")
|
||||
wagon_spacing = 2.65
|
||||
|
||||
[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="HUD" type="Control" parent="."]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[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="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="camera_label" type="Label" parent="HUD"]
|
||||
layout_mode = 0
|
||||
offset_left = 20.0
|
||||
offset_top = 93.0
|
||||
offset_right = 1280.0
|
||||
offset_bottom = 116.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 = 145.0
|
||||
offset_right = 1280.0
|
||||
offset_bottom = 272.0
|
||||
size_flags_vertical = 0
|
||||
text = "Comandi:
|
||||
\"W / S - Accelera / Rallenta\",
|
||||
\"A / D - Ruota camera\",
|
||||
\"SPACE - Cambia camera\",
|
||||
\"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="newtrain_button" type="Button" parent="HUD"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 594.0
|
||||
offset_top = 640.0
|
||||
offset_right = 700.0
|
||||
offset_bottom = 671.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
text = "Nuovo treno"
|
||||
|
||||
[node name="audio_button" type="Button" parent="HUD"]
|
||||
layout_mode = 0
|
||||
offset_left = 4.0
|
||||
offset_top = 701.0
|
||||
offset_right = 179.0
|
||||
offset_bottom = 877.0
|
||||
scale = Vector2(0.1, 0.1)
|
||||
icon = ExtResource("6_tipki")
|
||||
|
||||
[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=["state"] instance=ExtResource("7_o6xl0")]
|
||||
|
||||
[node name="AutoSaveTimer" type="Timer" parent="."]
|
||||
wait_time = 10.0
|
||||
|
||||
[connection signal="pressed" from="HUD/newtrain_button" to="Train" method="_on_button_pressed"]
|
||||
[connection signal="pressed" from="HUD/audio_button" to="MusicManager" method="_on_audio_button_pressed"]
|
||||
[connection signal="timeout" from="AutoSaveTimer" to="." method="_on_timer_timeout"]
|
||||
40
scenes/main.tscn4044033094.tmp
Normal file
40
scenes/main.tscn4044033094.tmp
Normal file
@@ -0,0 +1,40 @@
|
||||
[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="."]
|
||||
42
scenes/musicmanager.tscn
Normal file
42
scenes/musicmanager.tscn
Normal file
@@ -0,0 +1,42 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://qrf08uiuhyqg"]
|
||||
|
||||
[ext_resource type="AudioStream" uid="uid://bdluyy5uodjb5" path="res://resources/thomastanks_new.mp3" id="1_ht1d5"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_ht1d5"]
|
||||
script/source = "extends Node
|
||||
|
||||
@onready var AudioButton = $\"../HUD/audio_button\"
|
||||
@onready var player = $AudioStreamPlayer2D
|
||||
@export var icon_active: Texture2D
|
||||
@export var icon_inactive: Texture2D
|
||||
var isPlaying = true
|
||||
|
||||
func play_track():
|
||||
player.play()
|
||||
isPlaying = true
|
||||
if AudioButton:
|
||||
AudioButton.icon = icon_active
|
||||
|
||||
|
||||
func stop():
|
||||
player.stop()
|
||||
isPlaying = false
|
||||
if AudioButton:
|
||||
AudioButton.icon = icon_inactive
|
||||
|
||||
|
||||
func _on_audio_button_pressed() -> void:
|
||||
if isPlaying:
|
||||
stop()
|
||||
else:
|
||||
play_track()
|
||||
"
|
||||
|
||||
[node name="MusicManager" type="Node"]
|
||||
script = SubResource("GDScript_ht1d5")
|
||||
|
||||
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("1_ht1d5")
|
||||
volume_db = -5.0
|
||||
autoplay = true
|
||||
parameters/looping = false
|
||||
4
scenes/train.tscn
Normal file
4
scenes/train.tscn
Normal file
@@ -0,0 +1,4 @@
|
||||
[gd_scene format=3 uid="uid://cer3o7xlhju7v"]
|
||||
|
||||
[node name="Train" type="Node3D"]
|
||||
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 0, 0, 0)
|
||||
Reference in New Issue
Block a user