mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-04-27 15:25:35 +00:00
124 lines
3.2 KiB
Text
124 lines
3.2 KiB
Text
[gd_scene load_steps=6 format=3 uid="uid://bcv81ku26xo"]
|
|
|
|
[ext_resource type="StyleBox" uid="uid://cl7dmo2bg4153" path="res://interfaces/hud/healthbar_fill_style.tres" id="1_gh51l"]
|
|
|
|
[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 _ready():
|
|
_update_health_bar(100)
|
|
_update_energy_bar(100)
|
|
|
|
func _update_energy_bar(energy) -> void:
|
|
_energy_bar.value = energy
|
|
|
|
func _on_energy_changed(new_energy) -> void:
|
|
_update_energy_bar(new_energy)
|
|
|
|
func _update_health_bar(health) -> void:
|
|
_health_bar.value = health
|
|
|
|
func _on_health_changed(new_health) -> void:
|
|
_update_health_bar(new_health)
|
|
"
|
|
|
|
[sub_resource type="Theme" id="Theme_irfqb"]
|
|
|
|
[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 = ExtResource("1_gh51l")
|
|
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")
|
|
|
|
[node name="Reticle" type="Control" parent="."]
|
|
layout_mode = 3
|
|
anchors_preset = 8
|
|
anchor_left = 0.5
|
|
anchor_top = 0.5
|
|
anchor_right = 0.5
|
|
anchor_bottom = 0.5
|
|
offset_left = -20.0
|
|
offset_top = -20.0
|
|
offset_right = 20.0
|
|
offset_bottom = 20.0
|
|
grow_horizontal = 2
|
|
grow_vertical = 2
|
|
mouse_filter = 2
|
|
|
|
[node name="LineBottom" type="Line2D" parent="Reticle"]
|
|
position = Vector2(13, 4)
|
|
points = PackedVector2Array(7, 19, 7, 31)
|
|
width = 2.0
|
|
|
|
[node name="LineLeft" type="Line2D" parent="Reticle"]
|
|
position = Vector2(36, 13)
|
|
rotation = 1.5708
|
|
points = PackedVector2Array(7, 19, 7, 31)
|
|
width = 2.0
|
|
|
|
[node name="LineTop" type="Line2D" parent="Reticle"]
|
|
position = Vector2(13, -14)
|
|
points = PackedVector2Array(7, 19, 7, 31)
|
|
width = 2.0
|
|
|
|
[node name="LineRight" type="Line2D" parent="Reticle"]
|
|
position = Vector2(54, 13)
|
|
rotation = 1.5708
|
|
points = PackedVector2Array(7, 19, 7, 31)
|
|
width = 2.0
|