break-utopia/project/objects/ui/hud.tscn
2026-01-14 16:19:33 +01:00

282 lines
8.4 KiB
Text

[gd_scene format=3 uid="uid://csss0odg2jre1"]
[ext_resource type="Texture2D" uid="uid://cr56o21nptvt6" path="res://assets/ui/frame.svg" id="1_cer2l"]
[ext_resource type="Texture2D" uid="uid://kn5w07mgntvq" path="res://assets/ui/frame_base.svg" id="2_25bap"]
[ext_resource type="StyleBox" uid="uid://dx4vl7rb650ph" path="res://objects/ui/textbox_style.tres" id="3_lscdw"]
[ext_resource type="Texture2D" uid="uid://borgwswaglvre" path="res://assets/ui/style_letters/style_anarchic.png" id="4_ddhud"]
[ext_resource type="Texture2D" uid="uid://cce55w15k4obo" path="res://assets/ui/style_letters/style_fatal.png" id="4_xf154"]
[ext_resource type="Texture2D" uid="uid://ddnnht5030owy" path="res://assets/ui/style_letters/style_explosive.png" id="5_guo48"]
[ext_resource type="Texture2D" uid="uid://cu6xs12a4v4lv" path="res://assets/ui/style_letters/style_destructive.png" id="6_xf154"]
[ext_resource type="Texture2D" uid="uid://bsspt7d0wkkwc" path="res://assets/ui/style_letters/style_catastrophic.png" id="7_8u8q2"]
[ext_resource type="Texture2D" uid="uid://b304c6efrbpup" path="res://assets/ui/style_letters/style_breaking.png" id="8_o8kss"]
[sub_resource type="GDScript" id="GDScript_ddhud"]
resource_name = "PauseFrame"
script/source = "extends TextureRect
@export var base_texture : Texture2D
@export var action_texture : Texture2D
var timer : float = 0.0
func _process(delta: float):
texture = base_texture if timer <= 0 else action_texture
if get_tree().paused:
if timer <= 0:
flip_h = randi_range(0, 1) == 1
flip_v = randi_range(0, 1) == 1
timer = 0.5
if timer > 0:
timer -= delta
"
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_b61jh"]
bg_color = Color(0.34368983, 0.34368992, 0.34368974, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_cer2l"]
bg_color = Color(1, 0, 0.6000004, 1)
[sub_resource type="GDScript" id="GDScript_25bap"]
resource_name = "EnergyBar"
script/source = "extends ProgressBar
func _ready():
LevelStatus.get_instance().meter_changed.connect(_meter_changed)
_meter_changed(0)
func _meter_changed(meter: float):
self.value = meter
"
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_25bap"]
bg_color = Color(0.9999948, 0.22604719, 0.23252478, 1)
[sub_resource type="GDScript" id="GDScript_lscdw"]
resource_name = "HealthBar"
script/source = "extends ProgressBar
func _ready():
LevelStatus.get_instance().health_changed.connect(_health_changed)
_health_changed(1)
func _health_changed(health : float):
self.value = health
"
[sub_resource type="GDScript" id="GDScript_b61jh"]
script/source = "extends RichTextLabel
@export var textures : Array[Texture2D]
func _ready():
LevelStatus.get_instance().style_changed.connect(_style_changed)
_style_changed(0)
func _style_changed(style):
%StyleTexture.texture = textures[style]
match int(floor(style)):
0:
text = \"\"
1: # F
text = \"Fatal\"
2: # E
text = \"Explosive\"
3: # D
text = \"Destructive\"
4: # C
text = \"Catastrophic\"
5: # B
text = \"Breaking\"
6: # A
text = \"Anarchist\"
"
[sub_resource type="GDScript" id="GDScript_cer2l"]
script/source = "extends RichTextLabel
func _ready():
LevelStatus.get_instance().score_changed.connect(_score_changed)
_score_changed(0)
func _score_changed(score):
text = \"%d\" % (score * 10)
"
[node name="HUD" type="Control" unique_id=1572421341]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="Frame" type="TextureRect" parent="." unique_id=1783670110]
process_mode = 3
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
focus_behavior_recursive = 1
mouse_filter = 2
mouse_behavior_recursive = 1
texture = ExtResource("1_cer2l")
expand_mode = 1
script = SubResource("GDScript_ddhud")
base_texture = ExtResource("2_25bap")
action_texture = ExtResource("1_cer2l")
[node name="Energy" type="ProgressBar" parent="." unique_id=2024565875]
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -425.0
offset_bottom = 36.0
grow_horizontal = 0
theme_override_styles/background = SubResource("StyleBoxFlat_b61jh")
theme_override_styles/fill = SubResource("StyleBoxFlat_cer2l")
max_value = 1.0
value = 0.12
show_percentage = false
script = SubResource("GDScript_25bap")
[node name="RichTextLabel" type="RichTextLabel" parent="Energy" unique_id=933618211]
layout_mode = 1
offset_left = 14.0
offset_right = 359.0
offset_bottom = 35.0
theme_override_font_sizes/normal_font_size = 16
text = "Energy"
vertical_alignment = 1
[node name="Healthbar" type="ProgressBar" parent="." unique_id=1505270570]
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -32.0
offset_right = 421.0
grow_vertical = 0
theme_override_styles/background = SubResource("StyleBoxFlat_b61jh")
theme_override_styles/fill = SubResource("StyleBoxFlat_25bap")
max_value = 1.0
value = 0.65
show_percentage = false
script = SubResource("GDScript_lscdw")
[node name="RichTextLabel" type="RichTextLabel" parent="Healthbar" unique_id=1795506102]
layout_mode = 1
offset_left = 12.0
offset_right = 370.0
offset_bottom = 31.0
theme_override_font_sizes/normal_font_size = 16
text = "Health"
vertical_alignment = 1
[node name="Panel" type="Panel" parent="." unique_id=828550183]
layout_mode = 0
offset_left = 32.0
offset_top = 25.000004
offset_right = 192.33777
offset_bottom = 180.76624
rotation = 0.18656573
theme_override_styles/panel = ExtResource("3_lscdw")
[node name="PanelContainer" type="PanelContainer" parent="." unique_id=1876159707]
layout_mode = 0
offset_left = 51.0
offset_top = 170.00002
offset_right = 212.37106
offset_bottom = 223.00002
rotation = 0.04287675
theme_override_styles/panel = ExtResource("3_lscdw")
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer" unique_id=1058345758]
layout_mode = 2
theme_override_constants/separation = -10
[node name="RichTextLabel" type="RichTextLabel" parent="PanelContainer/HBoxContainer" unique_id=1440807256]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 0
mouse_filter = 2
theme_override_colors/default_color = Color(0, 0, 0, 1)
theme_override_font_sizes/normal_font_size = 16
text = "Destructive"
fit_content = true
scroll_active = false
vertical_alignment = 1
script = SubResource("GDScript_b61jh")
textures = Array[Texture2D]([null, ExtResource("4_xf154"), ExtResource("5_guo48"), ExtResource("6_xf154"), ExtResource("7_8u8q2"), ExtResource("8_o8kss"), ExtResource("4_ddhud")])
[node name="PanelContainer3" type="PanelContainer" parent="." unique_id=989343453]
layout_mode = 0
offset_left = 6.0
offset_top = 0.9842882
offset_right = 178.2187
offset_bottom = 53.984287
rotation = -0.025209446
theme_override_styles/panel = ExtResource("3_lscdw")
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer3" unique_id=534104434]
layout_mode = 2
theme_override_constants/separation = -10
[node name="RichTextLabel" type="RichTextLabel" parent="PanelContainer3/HBoxContainer" unique_id=1568784342]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 0
mouse_filter = 2
theme_override_colors/default_color = Color(0, 0, 0, 1)
theme_override_font_sizes/normal_font_size = 16
text = "Style:"
fit_content = true
scroll_active = false
vertical_alignment = 1
[node name="StyleTexture" type="TextureRect" parent="." unique_id=1404766304]
unique_name_in_owner = true
layout_mode = 0
offset_left = 34.0
offset_top = 49.0
offset_right = 173.26727
offset_bottom = 184.97601
rotation = 0.05656576
texture = ExtResource("4_ddhud")
expand_mode = 1
[node name="PanelContainer2" type="PanelContainer" parent="." unique_id=789180801]
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -306.40442
offset_top = -102.98761
offset_right = -28.595825
offset_bottom = -38.98755
grow_horizontal = 0
grow_vertical = 0
rotation = 0.07959896
theme_override_styles/panel = ExtResource("3_lscdw")
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer2" unique_id=788268433]
layout_mode = 2
[node name="RichTextLabel2" type="RichTextLabel" parent="PanelContainer2/VBoxContainer" unique_id=820506202]
layout_mode = 2
size_flags_vertical = 3
focus_mode = 0
mouse_filter = 2
theme_override_colors/default_color = Color(0, 0, 0, 1)
theme_override_font_sizes/normal_font_size = 24
text = "0"
fit_content = true
scroll_active = false
horizontal_alignment = 2
vertical_alignment = 1
script = SubResource("GDScript_cer2l")