mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-01-19 19:44:46 +00:00
85 lines
2.3 KiB
Plaintext
85 lines
2.3 KiB
Plaintext
[gd_scene load_steps=6 format=3 uid="uid://bcv81ku26xo"]
|
|
|
|
[sub_resource type="GDScript" id="GDScript_2vxif"]
|
|
script/source = "extends CanvasLayer
|
|
class_name HUD
|
|
|
|
@onready var health_bar = $HealthBar
|
|
@onready var energy_bar = $EnergyBar
|
|
|
|
func _update_energy_label(energy):
|
|
energy_bar.value = energy
|
|
|
|
func _on_energy_changed(new_energy) -> void:
|
|
_update_energy_label(new_energy)
|
|
|
|
func _update_health_label(health):
|
|
health_bar.value = health
|
|
|
|
func _on_health_changed(new_health) -> void:
|
|
_update_health_label(new_health)
|
|
"
|
|
|
|
[sub_resource type="Theme" id="Theme_irfqb"]
|
|
|
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_8ju42"]
|
|
bg_color = Color(1, 0.356863, 0.145098, 1)
|
|
|
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_f23s3"]
|
|
bg_color = Color(0, 0.454902, 0.992157, 1)
|
|
|
|
[sub_resource type="GDScript" id="GDScript_w8l21"]
|
|
script/source = "extends Label
|
|
|
|
@onready var player = get_parent().owner
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
pass # Replace with function body.
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(_delta):
|
|
text = \"\"
|
|
text += \"fps: %s\\n\" % str(Engine.get_frames_per_second())
|
|
text += \"position: %d, %d, %d\\n\" % [player.position.x, player.position.y, player.position.z]
|
|
text += \"speed: %d km/h\\n\" % (player.linear_velocity.length() * 3.6)
|
|
"
|
|
|
|
[node name="HUD" type="CanvasLayer"]
|
|
script = SubResource("GDScript_2vxif")
|
|
|
|
[node name="HealthBar" type="ProgressBar" parent="."]
|
|
offset_left = 32.0
|
|
offset_top = 32.0
|
|
offset_right = 288.0
|
|
offset_bottom = 40.0
|
|
size_flags_horizontal = 0
|
|
mouse_filter = 2
|
|
theme = SubResource("Theme_irfqb")
|
|
theme_override_styles/fill = SubResource("StyleBoxFlat_8ju42")
|
|
value = 60.0
|
|
show_percentage = false
|
|
|
|
[node name="EnergyBar" type="ProgressBar" parent="."]
|
|
offset_left = 32.0
|
|
offset_top = 48.0
|
|
offset_right = 288.0
|
|
offset_bottom = 56.0
|
|
size_flags_horizontal = 0
|
|
mouse_filter = 2
|
|
theme = SubResource("Theme_irfqb")
|
|
theme_override_styles/fill = SubResource("StyleBoxFlat_f23s3")
|
|
value = 60.0
|
|
show_percentage = false
|
|
|
|
[node name="DebugLabel" type="Label" parent="."]
|
|
anchors_preset = 2
|
|
anchor_top = 1.0
|
|
anchor_bottom = 1.0
|
|
offset_left = 20.0
|
|
offset_top = -33.0
|
|
offset_right = 21.0
|
|
offset_bottom = -10.0
|
|
grow_vertical = 0
|
|
script = SubResource("GDScript_w8l21")
|