Leo -Assets für GUI geladen

This commit is contained in:
2022-12-11 01:15:21 +01:00
parent 5e6b25f5cc
commit 553214600e
11 changed files with 241 additions and 0 deletions

30
menu/Speedometer.gd Normal file
View File

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

View File

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

45
menu/stats_player_1.tscn Normal file
View File

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