Leo - GUI checkpoint

This commit is contained in:
2022-12-11 05:19:46 +01:00
parent c201a1a08a
commit b87baba2fe
10 changed files with 228 additions and 50 deletions

View File

@@ -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.

View File

@@ -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="."]

View File

@@ -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):

View File

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

6
menu/stats_player_2.gd Normal file
View File

@@ -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

104
menu/stats_player_2.tscn Normal file
View File

@@ -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