mirror of
https://github.com/PfandBoss/SemesterGameJam2022.git
synced 2025-11-12 04:16:12 +01:00
Leo - GUI WIP
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
extends CanvasLayer
|
||||
|
||||
var currentSpeed
|
||||
|
||||
var maxSpeed = float(TrainEngine.maxSpeed)
|
||||
var minSpeed = 0.0
|
||||
|
||||
@@ -9,22 +8,20 @@ var deg
|
||||
var rad
|
||||
|
||||
@onready var root = self.get_parent()
|
||||
|
||||
#acceptable rotations range from -35 to +35 degrees
|
||||
func _ready():
|
||||
#get Game Node reference
|
||||
while not root is Game:
|
||||
root = root.get_parent()
|
||||
|
||||
print(root.name)
|
||||
print(maxSpeed)
|
||||
print("maxSpeed =", 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
|
||||
print("currentSpeed", currentSpeed)
|
||||
deg = currentSpeed * (70.0/maxSpeed) - 35.0
|
||||
print(deg)
|
||||
rad = (deg * 3.14) / 180
|
||||
self.get_node("Pfeil").rotation = rad
|
||||
|
||||
func round_to_digit(num, digit):
|
||||
return round(num * pow(10.0, digit)) / pow(10.0, digit)
|
||||
@@ -1,12 +1,12 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://cunv4n2t33057"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://bxlhdan6h6qwi"]
|
||||
|
||||
[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="Script" path="res://menu/Speedometer_player1.gd" id="1_8r0bw"]
|
||||
[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")
|
||||
script = ExtResource("1_8r0bw")
|
||||
|
||||
[node name="Background" type="TextureRect" parent="."]
|
||||
offset_right = 472.0
|
||||
|
||||
@@ -13,7 +13,6 @@ grow_vertical = 2
|
||||
script = ExtResource("1_hyw8p")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
@@ -22,7 +21,6 @@ grow_vertical = 2
|
||||
color = Color(0.513726, 0.403922, 0.27451, 1)
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
@@ -36,31 +34,42 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Start" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
offset_right = 87.0
|
||||
offset_bottom = 31.0
|
||||
text = "Start
|
||||
"
|
||||
|
||||
[node name="Tutorial" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
offset_top = 35.0
|
||||
offset_right = 87.0
|
||||
offset_bottom = 66.0
|
||||
text = "Tutorial
|
||||
"
|
||||
|
||||
[node name="Settings" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
offset_top = 70.0
|
||||
offset_right = 87.0
|
||||
offset_bottom = 101.0
|
||||
text = "Volume:"
|
||||
|
||||
[node name="VolSlider" type="HSlider" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
offset_top = 105.0
|
||||
offset_right = 87.0
|
||||
offset_bottom = 121.0
|
||||
min_value = -30.0
|
||||
max_value = 0.0
|
||||
script = ExtResource("2_h85ei")
|
||||
|
||||
[node name="Quit" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
offset_top = 125.0
|
||||
offset_right = 87.0
|
||||
offset_bottom = 156.0
|
||||
text = "Quit"
|
||||
|
||||
[node name="FullScreen" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
offset_top = 160.0
|
||||
offset_right = 87.0
|
||||
offset_bottom = 191.0
|
||||
text = "Fullscreen"
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/Start" to="." method="_on_start_pressed"]
|
||||
|
||||
5
menu/stats_player_1.gd
Normal file
5
menu/stats_player_1.gd
Normal file
@@ -0,0 +1,5 @@
|
||||
extends CanvasLayer
|
||||
|
||||
func _ready():
|
||||
var hbox = self.get_node("Rahmen/Ressourcen/RessourcenBox")
|
||||
hbox.add_spacer(true)
|
||||
@@ -1,9 +1,14 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://c8als41yc56ep"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://dgr3cta6n1tg3"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cunv4n2t33057" path="res://menu/Speedometer_player1.tscn" id="1_8v7ps"]
|
||||
[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://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"]
|
||||
script = ExtResource("1_7a1hg")
|
||||
|
||||
[node name="Speedometer_player1" parent="." instance=ExtResource("1_8v7ps")]
|
||||
scale = Vector2(0.4, 0.4)
|
||||
@@ -18,28 +23,60 @@ scale = Vector2(0.5, 0.5)
|
||||
texture = ExtResource("2_1uihe")
|
||||
|
||||
[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="HBoxContainer" type="HBoxContainer" parent="Rahmen/Ressourcen"]
|
||||
[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="VBoxContainer" type="VBoxContainer" parent="Rahmen/Ressourcen/HBoxContainer"]
|
||||
offset_right = 10.0
|
||||
offset_bottom = 30.0
|
||||
[node name="Kohle" type="VBoxContainer" parent="Rahmen/Ressourcen/RessourcenBox"]
|
||||
offset_right = 945.0
|
||||
offset_bottom = 977.0
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Rahmen/Ressourcen/HBoxContainer/VBoxContainer"]
|
||||
offset_right = 10.0
|
||||
[node name="TextureRect" type="TextureRect" parent="Rahmen/Ressourcen/RessourcenBox/Kohle"]
|
||||
offset_right = 945.0
|
||||
offset_bottom = 931.0
|
||||
texture = ExtResource("3_tjc2l")
|
||||
|
||||
[node name="Label" type="Label" parent="Rahmen/Ressourcen/HBoxContainer/VBoxContainer"]
|
||||
offset_top = 4.0
|
||||
offset_right = 10.0
|
||||
offset_bottom = 30.0
|
||||
[node name="Label" type="Label" parent="Rahmen/Ressourcen/RessourcenBox/Kohle"]
|
||||
offset_top = 935.0
|
||||
offset_right = 945.0
|
||||
offset_bottom = 961.0
|
||||
text = "5
|
||||
"
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="Rahmen/Ressourcen/HBoxContainer"]
|
||||
offset_left = 14.0
|
||||
offset_right = 14.0
|
||||
offset_bottom = 30.0
|
||||
[node name="GunPowder" type="VBoxContainer" parent="Rahmen/Ressourcen/RessourcenBox"]
|
||||
offset_left = 949.0
|
||||
offset_right = 1894.0
|
||||
offset_bottom = 977.0
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Rahmen/Ressourcen/RessourcenBox/GunPowder"]
|
||||
offset_right = 945.0
|
||||
offset_bottom = 931.0
|
||||
texture = ExtResource("4_jn38u")
|
||||
|
||||
[node name="Label" type="Label" parent="Rahmen/Ressourcen/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
|
||||
offset_bottom = 977.0
|
||||
|
||||
[node name="MunitionSprite" type="TextureRect" parent="Rahmen/Ressourcen/RessourcenBox/Munition"]
|
||||
offset_right = 945.0
|
||||
offset_bottom = 931.0
|
||||
texture = ExtResource("5_b5gk5")
|
||||
|
||||
[node name="Label" type="Label" parent="Rahmen/Ressourcen/RessourcenBox/Munition"]
|
||||
offset_top = 935.0
|
||||
offset_right = 945.0
|
||||
offset_bottom = 977.0
|
||||
theme_override_font_sizes/font_size = 30
|
||||
|
||||
Reference in New Issue
Block a user