⚗️ HUD updates

This commit is contained in:
schorsch_huckleberry 2024-04-20 19:40:23 +00:00 committed by anyreso
parent 7dbb72a1ff
commit f1dcad8c30
13 changed files with 491 additions and 282 deletions

View file

@ -1,4 +0,0 @@
[gd_resource type="StyleBoxFlat" format=3 uid="uid://cl7dmo2bg4153"]
[resource]
bg_color = Color(1, 0.356863, 0.145098, 1)

View file

@ -1,13 +1,14 @@
[gd_scene load_steps=6 format=3 uid="uid://bcv81ku26xo"]
[gd_scene load_steps=8 format=3 uid="uid://bcv81ku26xo"]
[ext_resource type="StyleBox" uid="uid://cl7dmo2bg4153" path="res://interfaces/hud/healthbar_fill_style.tres" id="1_gh51l"]
[ext_resource type="StyleBox" uid="uid://dcn1ll2ra4lwn" path="res://interfaces/hud/vitals/background.tres" id="1_gmv44"]
[ext_resource type="StyleBox" uid="uid://bq7rjpm38pao7" path="res://interfaces/hud/vitals/health_foreground.tres" id="2_6ejsl"]
[sub_resource type="GDScript" id="GDScript_2vxif"]
script/source = "extends CanvasLayer
class_name HUD
script/source = "class_name HUD extends CanvasLayer
@onready var _health_bar : ProgressBar = $HealthBar
@onready var _energy_bar : ProgressBar = $EnergyBar
@export_category(\"Vitals\")
@export var _health_bar : ProgressBar
@export var _energy_bar : ProgressBar
func _ready() -> void:
_update_health_bar(100.)
@ -26,11 +27,6 @@ func _on_health_changed(new_health : float) -> 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
@ -38,7 +34,8 @@ script/source = "extends Label
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
if not OS.is_debug_build():
queue_free()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta : float) -> void:
@ -48,76 +45,101 @@ func _process(_delta : float) -> void:
text += \"speed: %d km/h\\n\" % (player.linear_velocity.length() * 3.6)
"
[node name="HUD" type="CanvasLayer"]
[sub_resource type="Shader" id="Shader_gaah5"]
code = "shader_type canvas_item;
uniform vec4 color : source_color;
float circle(vec2 pos, float radius, float feather) {
return smoothstep(radius, radius - feather, length(pos - vec2(.5)));
}
void fragment() {
// draw reticle
float alpha = circle(UV, .5, .04);
COLOR = vec4(color.rgb, alpha);
}"
[sub_resource type="ShaderMaterial" id="ShaderMaterial_7blp5"]
shader = SubResource("Shader_gaah5")
shader_parameter/color = Color(1, 1, 1, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_f23s3"]
bg_color = Color(0.0901961, 0.87451, 0.760784, 0.65098)
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3
anti_aliasing = false
[node name="HUD" type="CanvasLayer" node_paths=PackedStringArray("_health_bar", "_energy_bar")]
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_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
_health_bar = NodePath("MarginContainer/HBoxContainer/VBoxContainer/HealthBar")
_energy_bar = NodePath("MarginContainer/HBoxContainer/VBoxContainer/EnergyBar")
[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_top = 20.0
offset_right = 21.0
offset_bottom = -10.0
grow_vertical = 0
offset_bottom = 43.0
script = SubResource("GDScript_w8l21")
[node name="Reticle" type="Control" parent="."]
layout_mode = 3
[node name="Reticle" type="ColorRect" parent="."]
material = SubResource("ShaderMaterial_7blp5")
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
offset_left = -1.5
offset_top = -1.5
offset_right = 1.5
offset_bottom = 1.5
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="MarginContainer" type="MarginContainer" parent="."]
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -42.0
grow_horizontal = 2
grow_vertical = 0
theme_override_constants/margin_left = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[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="HBoxContainer" type="HBoxContainer" parent="MarginContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="LineTop" type="Line2D" parent="Reticle"]
position = Vector2(13, -14)
points = PackedVector2Array(7, 19, 7, 31)
width = 2.0
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.2
theme_override_constants/separation = 6
[node name="LineRight" type="Line2D" parent="Reticle"]
position = Vector2(54, 13)
rotation = 1.5708
points = PackedVector2Array(7, 19, 7, 31)
width = 2.0
[node name="HealthBar" type="ProgressBar" parent="MarginContainer/HBoxContainer/VBoxContainer"]
custom_minimum_size = Vector2(0, 8)
layout_mode = 2
mouse_filter = 2
theme_override_styles/background = ExtResource("1_gmv44")
theme_override_styles/fill = ExtResource("2_6ejsl")
value = 60.0
show_percentage = false
[node name="EnergyBar" type="ProgressBar" parent="MarginContainer/HBoxContainer/VBoxContainer"]
custom_minimum_size = Vector2(0, 8)
layout_mode = 2
mouse_filter = 2
theme_override_styles/background = ExtResource("1_gmv44")
theme_override_styles/fill = SubResource("StyleBoxFlat_f23s3")
value = 60.0
show_percentage = false
[node name="Spacer" type="Control" parent="MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.8

View file

@ -1,12 +1,13 @@
[gd_scene load_steps=3 format=3 uid="uid://dsysi2rd3bu76"]
[gd_scene load_steps=4 format=3 uid="uid://dsysi2rd3bu76"]
[ext_resource type="Script" path="res://interfaces/hud/iff.gd" id="1_75yi1"]
[ext_resource type="StyleBox" uid="uid://cgv081wfih7la" path="res://interfaces/hud/iff_healthbar_fill_style.tres" id="2_frxvy"]
[ext_resource type="Script" path="res://interfaces/hud/iffs/iff.gd" id="1_g1wra"]
[ext_resource type="StyleBox" uid="uid://cgv081wfih7la" path="res://interfaces/hud/iffs/health_foreground.tres" id="2_e3xla"]
[ext_resource type="StyleBox" uid="uid://dcn1ll2ra4lwn" path="res://interfaces/hud/vitals/background.tres" id="2_jtos4"]
[node name="IFF" type="Control"]
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_75yi1")
script = ExtResource("1_g1wra")
[node name="IFFContainer" type="MarginContainer" parent="."]
layout_mode = 0
@ -34,7 +35,8 @@ offset_top = 20.0
offset_right = 63.0
offset_bottom = 24.0
mouse_filter = 2
theme_override_styles/fill = ExtResource("2_frxvy")
theme_override_styles/background = ExtResource("2_jtos4")
theme_override_styles/fill = ExtResource("2_e3xla")
value = 60.0
show_percentage = false

View file

@ -0,0 +1,9 @@
[gd_resource type="StyleBoxFlat" format=3 uid="uid://dcn1ll2ra4lwn"]
[resource]
bg_color = Color(0, 0, 0, 0.25)
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3
anti_aliasing = false

View file

@ -0,0 +1,10 @@
[gd_resource type="StyleBoxFlat" format=3 uid="uid://bq7rjpm38pao7"]
[resource]
resource_local_to_scene = true
bg_color = Color(0.025, 0.75, 0.1, 0.65)
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3
anti_aliasing = false