more work on the ui theme and changing the hud

This commit is contained in:
2025-11-05 08:28:07 +11:00
parent 2f4159ebbe
commit f257a5df68
187 changed files with 806 additions and 799 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d0yfidlyfyxff"
path="res://.godot/imported/health-Sheet.png-0fdb3ca3bd7269341e0271c38f6c9352.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://UI/ShieldUI/health-Sheet.png"
dest_files=["res://.godot/imported/health-Sheet.png-0fdb3ca3bd7269341e0271c38f6c9352.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bv3alwpq8esky"
path="res://.godot/imported/health_border.png-99006dff11f73b4b2477bea9384c83e2.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://UI/ShieldUI/health_border.png"
dest_files=["res://.godot/imported/health_border.png-99006dff11f73b4b2477bea9384c83e2.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bifqfvhsu4c2f"
path="res://.godot/imported/health_hit-Sheet.png-dc664b62759c22b42d5c36a63bd92934.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://UI/ShieldUI/health_hit-Sheet.png"
dest_files=["res://.godot/imported/health_hit-Sheet.png-dc664b62759c22b42d5c36a63bd92934.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

62
UI/ShieldUI/shield_ui.gd Normal file
View File

@@ -0,0 +1,62 @@
class_name ShieldUI
extends Control
@export var cells: Array[TextureRect] = []
@export var hit_glow: TextureRect
@export var fade_timer: Timer
const CELL_HEALTH: int = 9
var health: int = 144
var current_cell_health: int = CELL_HEALTH
var fade_tween: Tween
func take_damage(damage: int) -> void:
if fade_tween:
fade_tween.kill()
fade_tween = null
modulate = Color.WHITE
var damage_to_deal_with: int = min(damage, current_cell_health)
var remaining_damage: int = damage - damage_to_deal_with
var current_cell: int = ceili(float(health) / CELL_HEALTH)
health -= damage_to_deal_with
current_cell_health -= damage_to_deal_with
var cell_level: int = health % 9
if remaining_damage > 0: ## This cell should be empty because the damage overran the cell
cell_level = 3
current_cell_health = CELL_HEALTH
change_cell_color(current_cell - 1, cell_level)
take_damage(remaining_damage)
return
elif current_cell_health == 0:
cell_level = 3
current_cell_health = CELL_HEALTH
elif cell_level > 0 and cell_level <= 3: ## This cell should be low health
cell_level = 2
elif cell_level > 3 and cell_level <= 6: ## This cell should be half health
cell_level = 1
else: ## This cell should be full health
cell_level = 0
hit_glow.texture.region.position.x = 66.0 * (16 - current_cell)
var tween: Tween = create_tween()
tween.tween_callback(func() -> void: hit_glow.visible = true)
tween.tween_interval(0.07)
tween.tween_callback(func() -> void: hit_glow.visible = false)
tween.tween_interval(0.07)
tween.tween_callback(func() -> void: hit_glow.visible = true)
tween.tween_callback(change_cell_color.bind(current_cell - 1, cell_level))
tween.tween_interval(0.07)
tween.tween_callback(func() -> void: hit_glow.visible = false)
fade_timer.start()
func change_cell_color(cell: int, color: int) -> void:
cells[15 - cell].texture.region.position.x = 66.0 * color
func fade_out() -> void:
if fade_tween:
fade_tween.kill()
fade_tween = create_tween()
fade_tween.tween_property(self, "modulate", Color8(255, 255, 255, 0), 1.0)

View File

@@ -0,0 +1 @@
uid://kiivev1q63p0

201
UI/ShieldUI/shield_ui.tscn Normal file
View File

@@ -0,0 +1,201 @@
[gd_scene load_steps=22 format=3 uid="uid://cqslp83lf0ku0"]
[ext_resource type="Script" uid="uid://kiivev1q63p0" path="res://UI/ShieldUI/shield_ui.gd" id="1_aa64g"]
[ext_resource type="Texture2D" uid="uid://bv3alwpq8esky" path="res://UI/ShieldUI/health_border.png" id="2_lvnxo"]
[ext_resource type="Texture2D" uid="uid://d0yfidlyfyxff" path="res://UI/ShieldUI/health-Sheet.png" id="3_uoync"]
[ext_resource type="Texture2D" uid="uid://bifqfvhsu4c2f" path="res://UI/ShieldUI/health_hit-Sheet.png" id="4_yanml"]
[sub_resource type="AtlasTexture" id="AtlasTexture_5gv4u"]
atlas = ExtResource("3_uoync")
region = Rect2(0, 0, 66, 66)
[sub_resource type="AtlasTexture" id="AtlasTexture_ye2cs"]
atlas = ExtResource("3_uoync")
region = Rect2(0, 66, 66, 66)
[sub_resource type="AtlasTexture" id="AtlasTexture_gmtb0"]
atlas = ExtResource("3_uoync")
region = Rect2(0, 132, 66, 66)
[sub_resource type="AtlasTexture" id="AtlasTexture_ylmjw"]
atlas = ExtResource("3_uoync")
region = Rect2(0, 198, 66, 66)
[sub_resource type="AtlasTexture" id="AtlasTexture_ulao6"]
atlas = ExtResource("3_uoync")
region = Rect2(0, 264, 66, 66)
[sub_resource type="AtlasTexture" id="AtlasTexture_usluy"]
atlas = ExtResource("3_uoync")
region = Rect2(0, 330, 66, 66)
[sub_resource type="AtlasTexture" id="AtlasTexture_kgv6k"]
atlas = ExtResource("3_uoync")
region = Rect2(0, 396, 66, 66)
[sub_resource type="AtlasTexture" id="AtlasTexture_ymret"]
atlas = ExtResource("3_uoync")
region = Rect2(0, 462, 66, 66)
[sub_resource type="AtlasTexture" id="AtlasTexture_d35xv"]
atlas = ExtResource("3_uoync")
region = Rect2(0, 528, 66, 66)
[sub_resource type="AtlasTexture" id="AtlasTexture_yyjyl"]
atlas = ExtResource("3_uoync")
region = Rect2(0, 594, 66, 66)
[sub_resource type="AtlasTexture" id="AtlasTexture_p3fdm"]
atlas = ExtResource("3_uoync")
region = Rect2(0, 660, 66, 66)
[sub_resource type="AtlasTexture" id="AtlasTexture_2xxhe"]
atlas = ExtResource("3_uoync")
region = Rect2(0, 726, 66, 66)
[sub_resource type="AtlasTexture" id="AtlasTexture_8cwn3"]
atlas = ExtResource("3_uoync")
region = Rect2(0, 792, 66, 66)
[sub_resource type="AtlasTexture" id="AtlasTexture_q14re"]
atlas = ExtResource("3_uoync")
region = Rect2(0, 858, 66, 66)
[sub_resource type="AtlasTexture" id="AtlasTexture_nmmm8"]
atlas = ExtResource("3_uoync")
region = Rect2(0, 924, 66, 66)
[sub_resource type="AtlasTexture" id="AtlasTexture_vp71v"]
atlas = ExtResource("3_uoync")
region = Rect2(0, 990, 66, 66)
[sub_resource type="AtlasTexture" id="AtlasTexture_slxus"]
atlas = ExtResource("4_yanml")
region = Rect2(0, 0, 66, 66)
[node name="ShieldUI" type="Control" node_paths=PackedStringArray("cells", "hit_glow", "fade_timer")]
modulate = Color(1, 1, 1, 0)
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_aa64g")
cells = [NodePath("Border/Cell1"), NodePath("Border/Cell2"), NodePath("Border/Cell3"), NodePath("Border/Cell4"), NodePath("Border/Cell5"), NodePath("Border/Cell6"), NodePath("Border/Cell7"), NodePath("Border/Cell8"), NodePath("Border/Cell9"), NodePath("Border/Cell10"), NodePath("Border/Cell11"), NodePath("Border/Cell12"), NodePath("Border/Cell13"), NodePath("Border/Cell14"), NodePath("Border/Cell15"), NodePath("Border/Cell16")]
hit_glow = NodePath("HitGlow")
fade_timer = NodePath("Timer")
[node name="Border" type="TextureRect" parent="."]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = ExtResource("2_lvnxo")
stretch_mode = 5
[node name="Cell1" type="TextureRect" parent="Border"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_5gv4u")
[node name="Cell2" type="TextureRect" parent="Border"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_ye2cs")
[node name="Cell3" type="TextureRect" parent="Border"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_gmtb0")
[node name="Cell4" type="TextureRect" parent="Border"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_ylmjw")
[node name="Cell5" type="TextureRect" parent="Border"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_ulao6")
[node name="Cell6" type="TextureRect" parent="Border"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_usluy")
[node name="Cell7" type="TextureRect" parent="Border"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_kgv6k")
[node name="Cell8" type="TextureRect" parent="Border"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_ymret")
[node name="Cell9" type="TextureRect" parent="Border"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_d35xv")
[node name="Cell10" type="TextureRect" parent="Border"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_yyjyl")
[node name="Cell11" type="TextureRect" parent="Border"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_p3fdm")
[node name="Cell12" type="TextureRect" parent="Border"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_2xxhe")
[node name="Cell13" type="TextureRect" parent="Border"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_8cwn3")
[node name="Cell14" type="TextureRect" parent="Border"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_q14re")
[node name="Cell15" type="TextureRect" parent="Border"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_nmmm8")
[node name="Cell16" type="TextureRect" parent="Border"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_vp71v")
[node name="HitGlow" type="TextureRect" parent="."]
visible = false
modulate = Color(1, 1, 1, 0.8)
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_slxus")
stretch_mode = 5
[node name="Timer" type="Timer" parent="."]
wait_time = 2.0
one_shot = true
[connection signal="timeout" from="Timer" to="." method="fade_out"]