diff --git a/Assets/Textures/GUI/upscaledSign.png b/Assets/Textures/GUI/upscaledSign.png new file mode 100644 index 0000000..2e18e02 Binary files /dev/null and b/Assets/Textures/GUI/upscaledSign.png differ diff --git a/Assets/Textures/GUI/upscaledSign.png.import b/Assets/Textures/GUI/upscaledSign.png.import new file mode 100644 index 0000000..221f2f9 --- /dev/null +++ b/Assets/Textures/GUI/upscaledSign.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cj3ipy1gilaxu" +path="res://.godot/imported/upscaledSign.png-d4dcd62d1293f4203dca4442ed30f800.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Textures/GUI/upscaledSign.png" +dest_files=["res://.godot/imported/upscaledSign.png-d4dcd62d1293f4203dca4442ed30f800.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/Nodes/UI.tscn b/Nodes/UI.tscn index 64e4703..1b2c4fb 100644 --- a/Nodes/UI.tscn +++ b/Nodes/UI.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=7 format=3 uid="uid://cys06pnxfjl2m"] +[gd_scene load_steps=8 format=3 uid="uid://cys06pnxfjl2m"] [ext_resource type="Texture2D" uid="uid://b8rsm7uapp583" path="res://undefined - Imgur (1).png" id="1_cb7ct"] [ext_resource type="Texture2D" uid="uid://44lfs83sax35" path="res://undefined - Imgur.png" id="2_udann"] [ext_resource type="PackedScene" uid="uid://dgr3cta6n1tg3" path="res://menu/stats_player_1.tscn" id="3_yhsvf"] +[ext_resource type="PackedScene" uid="uid://bpvxwo2otee3b" path="res://menu/stats_player_2.tscn" id="4_c4m18"] [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_fir3c"] @@ -22,7 +23,6 @@ size_flags_horizontal = 4 [node name="Panel" type="Panel" parent="."] custom_minimum_size = Vector2(15, 0) -layout_mode = 1 anchors_preset = 13 anchor_left = 0.5 anchor_right = 0.5 @@ -31,7 +31,6 @@ grow_horizontal = 2 grow_vertical = 2 [node name="VSlider" type="VSlider" parent="."] -layout_mode = 1 anchors_preset = 13 anchor_left = 0.5 anchor_right = 0.5 @@ -49,7 +48,6 @@ editable = false scrollable = false [node name="VSlider2" type="VSlider" parent="."] -layout_mode = 1 anchors_preset = 13 anchor_left = 0.5 anchor_right = 0.5 @@ -66,4 +64,19 @@ value = 50.0 editable = false scrollable = false -[node name="Stats_Player1" parent="." instance=ExtResource("3_yhsvf")] +[node name="Control" type="Control" parent="."] +layout_mode = 3 +anchors_preset = 0 +offset_left = -579.0 +offset_right = 575.0 +offset_bottom = 649.0 + +[node name="Stats_Player1" parent="Control" instance=ExtResource("3_yhsvf")] +offset_right = 345.0 +offset_bottom = -288.0 +scale = Vector2(0.6, 0.6) + +[node name="Stats_Player2" parent="Control" instance=ExtResource("4_c4m18")] +offset_left = -187.0 +offset_right = 125.0 +scale = Vector2(0.6, 0.6) diff --git a/menu/Speedometer_player1.gd b/menu/Speedometer_player1.gd index 97f6dcb..7709b42 100644 --- a/menu/Speedometer_player1.gd +++ b/menu/Speedometer_player1.gd @@ -1,4 +1,4 @@ -extends CanvasLayer +extends Control var currentSpeed var maxSpeed = float(TrainEngine.maxSpeed) @@ -13,15 +13,14 @@ func _ready(): #get Game Node reference while not root is Game: root = root.get_parent() - - print("maxSpeed =", maxSpeed) func _process(delta): currentSpeed = root.p1_train.current_speed - print("currentSpeed", currentSpeed) deg = currentSpeed * (70.0/maxSpeed) - 35.0 - print(deg) rad = (deg * 3.14) / 180 self.get_node("Pfeil").rotation = rad +func _on_stats_player_1_resized(): + print("resized") + pass # Replace with function body. diff --git a/menu/Speedometer_player1.tscn b/menu/Speedometer_player1.tscn index b0159f6..5ff7a61 100644 --- a/menu/Speedometer_player1.tscn +++ b/menu/Speedometer_player1.tscn @@ -5,7 +5,11 @@ [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"] +[node name="Speedometer" type="Control"] +layout_mode = 3 +anchors_preset = 0 +offset_right = 483.0 +offset_bottom = 505.0 script = ExtResource("1_8r0bw") [node name="Background" type="TextureRect" parent="."] diff --git a/menu/stats_player_1.gd b/menu/stats_player_1.gd index 66330fd..296187f 100644 --- a/menu/stats_player_1.gd +++ b/menu/stats_player_1.gd @@ -1,5 +1,10 @@ -extends CanvasLayer +extends Control func _ready(): - var hbox = self.get_node("Rahmen/Ressourcen/RessourcenBox") - hbox.add_spacer(true) + pass + + +func _process(delta): + + + diff --git a/menu/stats_player_1.tscn b/menu/stats_player_1.tscn index 20e6b03..bc4a532 100644 --- a/menu/stats_player_1.tscn +++ b/menu/stats_player_1.tscn @@ -2,81 +2,90 @@ [ext_resource type="Script" path="res://menu/stats_player_1.gd" id="1_7a1hg"] [ext_resource type="PackedScene" uid="uid://bxlhdan6h6qwi" 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"] [ext_resource type="Texture2D" uid="uid://dfqal4ri4ftrf" path="res://Assets/Textures/Kohle.png" id="3_tjc2l"] +[ext_resource type="Texture2D" uid="uid://cj3ipy1gilaxu" path="res://Assets/Textures/GUI/upscaledSign.png" id="3_v32w1"] [ext_resource type="Texture2D" uid="uid://clemmheiw1kq" path="res://Assets/Textures/Gunpowder.png" id="4_jn38u"] [ext_resource type="Texture2D" uid="uid://bhmyyu0uhx541" path="res://Assets/Textures/Opera_senza_titolo (2).png" id="5_b5gk5"] -[node name="Stats_Player1" type="CanvasLayer"] +[node name="Stats_Player1" type="Control"] +layout_mode = 3 +anchors_preset = 9 +anchor_bottom = 1.0 +offset_right = 370.0 +grow_vertical = 2 script = ExtResource("1_7a1hg") [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) +offset_right = 516.0 +offset_bottom = 494.0 +scale = Vector2(0.5, 0.5) -[node name="Rahmen" type="CanvasLayer" parent="."] - -[node name="Rahmen" type="TextureRect" parent="Rahmen"] +[node name="Rahmen2" type="TextureRect" parent="."] offset_right = 463.0 offset_bottom = 562.0 -scale = Vector2(0.5, 0.5) -texture = ExtResource("2_1uihe") +scale = Vector2(0.7, 0.7) +texture = ExtResource("3_v32w1") -[node name="Ressourcen" type="CanvasLayer" parent="Rahmen"] -offset = Vector2(0, 220) -scale = Vector2(0.02, 0.02) -transform = Transform2D(0.02, 0, 0, 0.02, 0, 220) +[node name="RessourcenBox" type="HBoxContainer" parent="."] +visible = false +anchors_preset = 2 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_left = 67.0 +offset_top = -316.0 +offset_right = 3562.0 +offset_bottom = 661.0 +grow_vertical = 0 +scale = Vector2(0.05, 0.05) +theme_override_constants/separation = 330 -[node name="RessourcenBox" type="HBoxContainer" parent="Rahmen/Ressourcen"] -custom_minimum_size = Vector2(100, 20) -offset_left = 40.0 -offset_top = 226.0 -offset_right = 123.0 -offset_bottom = 256.0 - -[node name="Kohle" type="VBoxContainer" parent="Rahmen/Ressourcen/RessourcenBox"] +[node name="Kohle" type="VBoxContainer" parent="RessourcenBox"] offset_right = 945.0 offset_bottom = 977.0 +theme_override_constants/separation = 10 -[node name="TextureRect" type="TextureRect" parent="Rahmen/Ressourcen/RessourcenBox/Kohle"] +[node name="TextureRect" type="TextureRect" parent="RessourcenBox/Kohle"] offset_right = 945.0 offset_bottom = 931.0 texture = ExtResource("3_tjc2l") -[node name="Label" type="Label" parent="Rahmen/Ressourcen/RessourcenBox/Kohle"] -offset_top = 935.0 +[node name="Label" type="Label" parent="RessourcenBox/Kohle"] +offset_top = 941.0 offset_right = 945.0 -offset_bottom = 961.0 +offset_bottom = 967.0 text = "5 " -[node name="GunPowder" type="VBoxContainer" parent="Rahmen/Ressourcen/RessourcenBox"] -offset_left = 949.0 -offset_right = 1894.0 +[node name="GunPowder" type="VBoxContainer" parent="RessourcenBox"] +offset_left = 1275.0 +offset_right = 2220.0 offset_bottom = 977.0 -[node name="TextureRect" type="TextureRect" parent="Rahmen/Ressourcen/RessourcenBox/GunPowder"] +[node name="TextureRect" type="TextureRect" parent="RessourcenBox/GunPowder"] offset_right = 945.0 offset_bottom = 931.0 texture = ExtResource("4_jn38u") -[node name="Label" type="Label" parent="Rahmen/Ressourcen/RessourcenBox/GunPowder"] +[node name="Label" type="Label" parent="RessourcenBox/GunPowder"] offset_top = 935.0 offset_right = 945.0 offset_bottom = 958.0 -[node name="Munition" type="VBoxContainer" parent="Rahmen/Ressourcen/RessourcenBox"] -offset_left = 1898.0 -offset_right = 2843.0 +[node name="Munition" type="VBoxContainer" parent="RessourcenBox"] +offset_left = 2550.0 +offset_right = 3495.0 offset_bottom = 977.0 +size_flags_stretch_ratio = 0.39 -[node name="MunitionSprite" type="TextureRect" parent="Rahmen/Ressourcen/RessourcenBox/Munition"] +[node name="MunitionSprite" type="TextureRect" parent="RessourcenBox/Munition"] offset_right = 945.0 offset_bottom = 931.0 texture = ExtResource("5_b5gk5") -[node name="Label" type="Label" parent="Rahmen/Ressourcen/RessourcenBox/Munition"] +[node name="Label" type="Label" parent="RessourcenBox/Munition"] offset_top = 935.0 offset_right = 945.0 offset_bottom = 977.0 theme_override_font_sizes/font_size = 30 + +[connection signal="resized" from="." to="Speedometer_player1" method="_on_stats_player_1_resized"] diff --git a/menu/stats_player_2.gd b/menu/stats_player_2.gd new file mode 100644 index 0000000..214b8a7 --- /dev/null +++ b/menu/stats_player_2.gd @@ -0,0 +1,6 @@ +extends Control + +func _ready(): + var gui = self.get_node("Speedometer_player1") + for body in gui.get_children(): + body.anchors_preset = CORNER_TOP_RIGHT diff --git a/menu/stats_player_2.tscn b/menu/stats_player_2.tscn new file mode 100644 index 0000000..c695a5b --- /dev/null +++ b/menu/stats_player_2.tscn @@ -0,0 +1,104 @@ +[gd_scene load_steps=7 format=3 uid="uid://bpvxwo2otee3b"] + +[ext_resource type="PackedScene" uid="uid://bxlhdan6h6qwi" path="res://menu/Speedometer_player1.tscn" id="1_8v7ps"] +[ext_resource type="Script" path="res://menu/stats_player_2.gd" id="1_buc37"] +[ext_resource type="Texture2D" uid="uid://qud0m3iwlyed" path="res://Assets/Textures/GUI/frame_player2.png" id="3_mx7a4"] +[ext_resource type="Texture2D" uid="uid://dfqal4ri4ftrf" path="res://Assets/Textures/Kohle.png" id="3_tjc2l"] +[ext_resource type="Texture2D" uid="uid://clemmheiw1kq" path="res://Assets/Textures/Gunpowder.png" id="4_jn38u"] +[ext_resource type="Texture2D" uid="uid://bhmyyu0uhx541" path="res://Assets/Textures/Opera_senza_titolo (2).png" id="5_b5gk5"] + +[node name="Stats_Player2" type="Control"] +layout_mode = 3 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -312.0 +offset_bottom = 409.0 +grow_horizontal = 0 +script = ExtResource("1_buc37") + +[node name="Speedometer_player1" parent="." instance=ExtResource("1_8v7ps")] +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -249.0 +offset_right = 249.0 +offset_bottom = 490.0 +grow_horizontal = 0 +scale = Vector2(0.5, 0.5) + +[node name="Rahmen2" type="TextureRect" parent="."] +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -324.0 +offset_right = 139.0 +offset_bottom = 562.0 +grow_horizontal = 0 +scale = Vector2(0.7, 0.7) +texture = ExtResource("3_mx7a4") + +[node name="RessourcenBox" type="HBoxContainer" parent="."] +visible = false +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -228.0 +offset_top = -78.0 +offset_right = 3267.0 +offset_bottom = 982.0 +grow_horizontal = 0 +grow_vertical = 0 +scale = Vector2(0.05, 0.05) +theme_override_constants/separation = 330 + +[node name="Kohle" type="VBoxContainer" parent="RessourcenBox"] +offset_right = 945.0 +offset_bottom = 1060.0 +theme_override_constants/separation = 10 + +[node name="TextureRect" type="TextureRect" parent="RessourcenBox/Kohle"] +offset_right = 945.0 +offset_bottom = 931.0 +texture = ExtResource("3_tjc2l") + +[node name="Label" type="Label" parent="RessourcenBox/Kohle"] +offset_top = 941.0 +offset_right = 945.0 +offset_bottom = 967.0 +text = "5 +" + +[node name="GunPowder" type="VBoxContainer" parent="RessourcenBox"] +offset_left = 1275.0 +offset_right = 2220.0 +offset_bottom = 1060.0 + +[node name="TextureRect" type="TextureRect" parent="RessourcenBox/GunPowder"] +offset_right = 945.0 +offset_bottom = 931.0 +texture = ExtResource("4_jn38u") + +[node name="Label" type="Label" parent="RessourcenBox/GunPowder"] +offset_top = 935.0 +offset_right = 945.0 +offset_bottom = 958.0 + +[node name="Munition" type="VBoxContainer" parent="RessourcenBox"] +offset_left = 2550.0 +offset_right = 3495.0 +offset_bottom = 1060.0 +size_flags_stretch_ratio = 0.39 + +[node name="MunitionSprite" type="TextureRect" parent="RessourcenBox/Munition"] +offset_right = 945.0 +offset_bottom = 931.0 +texture = ExtResource("5_b5gk5") + +[node name="Label" type="Label" parent="RessourcenBox/Munition"] +offset_top = 935.0 +offset_right = 945.0 +offset_bottom = 977.0 +theme_override_font_sizes/font_size = 30 diff --git a/project.godot b/project.godot index 54075ea..16809a6 100644 --- a/project.godot +++ b/project.godot @@ -29,7 +29,7 @@ _global_script_classes=[{ "language": &"GDScript", "path": "res://scripts/Logic/MapNode.gd" }, { -"base": "Node", +"base": "StaticBody3D", "class": &"Module", "language": &"GDScript", "path": "res://scripts/Modules/Module.gd" @@ -86,6 +86,10 @@ config/features=PackedStringArray("4.0", "Forward Plus") config/icon="res://icon.svg" <<<<<<