diff --git a/Assets/Textures/GUI/Speedometer_background.png b/Assets/Textures/GUI/Speedometer_background.png new file mode 100644 index 0000000..14a93df Binary files /dev/null and b/Assets/Textures/GUI/Speedometer_background.png differ diff --git a/Assets/Textures/GUI/Speedometer_background.png.import b/Assets/Textures/GUI/Speedometer_background.png.import new file mode 100644 index 0000000..1fadb9a --- /dev/null +++ b/Assets/Textures/GUI/Speedometer_background.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cj5tvg0uksgif" +path="res://.godot/imported/Speedometer_background.png-36e6b41abb1bb4cff0fa57f4cd212590.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Textures/GUI/Speedometer_background.png" +dest_files=["res://.godot/imported/Speedometer_background.png-36e6b41abb1bb4cff0fa57f4cd212590.ctex"] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Assets/Textures/GUI/Speedometer_foreground.png b/Assets/Textures/GUI/Speedometer_foreground.png new file mode 100644 index 0000000..bf109c1 Binary files /dev/null and b/Assets/Textures/GUI/Speedometer_foreground.png differ diff --git a/Assets/Textures/GUI/Speedometer_foreground.png.import b/Assets/Textures/GUI/Speedometer_foreground.png.import new file mode 100644 index 0000000..d04bf86 --- /dev/null +++ b/Assets/Textures/GUI/Speedometer_foreground.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c8087dusjhilc" +path="res://.godot/imported/Speedometer_foreground.png-e9753c34156799290374c579413237fa.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Textures/GUI/Speedometer_foreground.png" +dest_files=["res://.godot/imported/Speedometer_foreground.png-e9753c34156799290374c579413237fa.ctex"] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Assets/Textures/GUI/Speedometer_pointer.png b/Assets/Textures/GUI/Speedometer_pointer.png new file mode 100644 index 0000000..3f57487 Binary files /dev/null and b/Assets/Textures/GUI/Speedometer_pointer.png differ diff --git a/Assets/Textures/GUI/Speedometer_pointer.png.import b/Assets/Textures/GUI/Speedometer_pointer.png.import new file mode 100644 index 0000000..61f661c --- /dev/null +++ b/Assets/Textures/GUI/Speedometer_pointer.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://hy1r4mahhob2" +path="res://.godot/imported/Speedometer_pointer.png-78b22e60c608fc9d8b347b899fac4f96.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Textures/GUI/Speedometer_pointer.png" +dest_files=["res://.godot/imported/Speedometer_pointer.png-78b22e60c608fc9d8b347b899fac4f96.ctex"] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Assets/Textures/GUI/frame_player1.png b/Assets/Textures/GUI/frame_player1.png new file mode 100644 index 0000000..a57de02 Binary files /dev/null and b/Assets/Textures/GUI/frame_player1.png differ diff --git a/Assets/Textures/GUI/frame_player1.png.import b/Assets/Textures/GUI/frame_player1.png.import new file mode 100644 index 0000000..beee7c7 --- /dev/null +++ b/Assets/Textures/GUI/frame_player1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c62xglrjom4sn" +path="res://.godot/imported/frame_player1.png-3a9ba716dcebf31c0b02a838e38392eb.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Textures/GUI/frame_player1.png" +dest_files=["res://.godot/imported/frame_player1.png-3a9ba716dcebf31c0b02a838e38392eb.ctex"] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/menu/Speedometer.gd b/menu/Speedometer.gd new file mode 100644 index 0000000..712c57b --- /dev/null +++ b/menu/Speedometer.gd @@ -0,0 +1,30 @@ +extends CanvasLayer + +var currentSpeed + +var maxSpeed = float(TrainEngine.maxSpeed) +var minSpeed = 0.0 + +var deg +var rad + +@onready var root = self.get_parent() + +func _ready(): + #get Game Node reference + while not root is Game: + root = root.get_parent() + + print(root.name) + print(maxSpeed) + +#acceptable rotations range from -35 to +35 degrees +func _process(delta): + + currentSpeed = root.p1_train.current_speed + deg = ((70.0/maxSpeed)* currentSpeed) - 35.0 + rad = (deg * 3.14)/180.0 + self.get_node("Pfeil").rotation = rad + +func round_to_digit(num, digit): + return round(num * pow(10.0, digit)) / pow(10.0, digit) diff --git a/menu/Speedometer_player1.tscn b/menu/Speedometer_player1.tscn new file mode 100644 index 0000000..2924c08 --- /dev/null +++ b/menu/Speedometer_player1.tscn @@ -0,0 +1,30 @@ +[gd_scene load_steps=5 format=3 uid="uid://cunv4n2t33057"] + +[ext_resource type="Texture2D" uid="uid://cj5tvg0uksgif" path="res://Assets/Textures/GUI/Speedometer_background.png" id="1_8h3os"] +[ext_resource type="Script" path="res://menu/Scripts/Speedometer.gd" id="1_qr0vh"] +[ext_resource type="Texture2D" uid="uid://hy1r4mahhob2" path="res://Assets/Textures/GUI/Speedometer_pointer.png" id="2_vm8nm"] +[ext_resource type="Texture2D" uid="uid://c8087dusjhilc" path="res://Assets/Textures/GUI/Speedometer_foreground.png" id="3_7tp67"] + +[node name="Speedometer" type="CanvasLayer"] +script = ExtResource("1_qr0vh") + +[node name="Background" type="TextureRect" parent="."] +offset_right = 472.0 +offset_bottom = 463.0 +size_flags_horizontal = 4 +size_flags_vertical = 4 +texture = ExtResource("1_8h3os") + +[node name="Pfeil" type="TextureRect" parent="."] +offset_right = 472.0 +offset_bottom = 463.0 +scale = Vector2(0.9, 0.9) +pivot_offset = Vector2(242, 320) +texture = ExtResource("2_vm8nm") + +[node name="Foreground" type="TextureRect" parent="."] +offset_right = 472.0 +offset_bottom = 463.0 +pivot_offset = Vector2(230, 230) +texture = ExtResource("3_7tp67") +metadata/_edit_use_anchors_ = true diff --git a/menu/stats_player_1.tscn b/menu/stats_player_1.tscn new file mode 100644 index 0000000..a60e864 --- /dev/null +++ b/menu/stats_player_1.tscn @@ -0,0 +1,45 @@ +[gd_scene load_steps=3 format=3 uid="uid://c8als41yc56ep"] + +[ext_resource type="PackedScene" uid="uid://cunv4n2t33057" path="res://menu/Speedometer_player1.tscn" id="1_8v7ps"] +[ext_resource type="Texture2D" uid="uid://c62xglrjom4sn" path="res://Assets/Textures/GUI/frame_player1.png" id="2_1uihe"] + +[node name="Stats_Player1" type="CanvasLayer"] + +[node name="Speedometer_player1" parent="." instance=ExtResource("1_8v7ps")] +scale = Vector2(0.4, 0.4) +transform = Transform2D(0.4, 0, 0, 0.4, 0, 0) + +[node name="Rahmen" type="CanvasLayer" parent="."] + +[node name="Rahmen" type="TextureRect" parent="Rahmen"] +offset_right = 463.0 +offset_bottom = 562.0 +scale = Vector2(0.5, 0.5) +texture = ExtResource("2_1uihe") + +[node name="Ressourcen" type="CanvasLayer" parent="Rahmen"] + +[node name="HBoxContainer" type="HBoxContainer" parent="Rahmen/Ressourcen"] +offset_left = 40.0 +offset_top = 226.0 +offset_right = 123.0 +offset_bottom = 256.0 + +[node name="VBoxContainer" type="VBoxContainer" parent="Rahmen/Ressourcen/HBoxContainer"] +offset_right = 10.0 +offset_bottom = 30.0 + +[node name="TextureRect" type="TextureRect" parent="Rahmen/Ressourcen/HBoxContainer/VBoxContainer"] +offset_right = 10.0 + +[node name="Label" type="Label" parent="Rahmen/Ressourcen/HBoxContainer/VBoxContainer"] +offset_top = 4.0 +offset_right = 10.0 +offset_bottom = 30.0 +text = "5 +" + +[node name="VBoxContainer2" type="VBoxContainer" parent="Rahmen/Ressourcen/HBoxContainer"] +offset_left = 14.0 +offset_right = 14.0 +offset_bottom = 30.0