generated from krampus/template-godot4
Power gauge & life bar HUD elements
This commit is contained in:
parent
2b1aabd808
commit
96c73c5587
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b5812y3pmmgg5"
|
||||
path="res://.godot/imported/gauge_patch.png-b06ef6737fda05dbce8a7a52b995acf4.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/ui/gauge_patch.png"
|
||||
dest_files=["res://.godot/imported/gauge_patch.png-b06ef6737fda05dbce8a7a52b995acf4.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
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/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.
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dtdqninlnu10o"
|
||||
path="res://.godot/imported/lifebar_fill_grey.png-c028996d6e86e26137270a39216a5fd3.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/ui/lifebar_fill_grey.png"
|
||||
dest_files=["res://.godot/imported/lifebar_fill_grey.png-c028996d6e86e26137270a39216a5fd3.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
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/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.
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bvwh0yunmvirp"
|
||||
path="res://.godot/imported/lifebar_patch.png-768842f340e38f78b7b90bbcd2d8dff9.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/ui/lifebar_patch.png"
|
||||
dest_files=["res://.godot/imported/lifebar_patch.png-768842f340e38f78b7b90bbcd2d8dff9.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
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/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.
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://76fjx2ukavqe"
|
||||
path="res://.godot/imported/power_gauge_fill.png-b7c279ae4fc601ab214f21b9b72d50c3.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/ui/power_gauge_fill.png"
|
||||
dest_files=["res://.godot/imported/power_gauge_fill.png-b7c279ae4fc601ab214f21b9b72d50c3.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
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/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.
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://4a8tvjgwegv3"
|
||||
path="res://.godot/imported/power_gauge_tab.png-7979d59b50c40895525fdf1648e50b30.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/ui/power_gauge_tab.png"
|
||||
dest_files=["res://.godot/imported/power_gauge_tab.png-7979d59b50c40895525fdf1648e50b30.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
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/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
|
|
@ -9,6 +9,7 @@
|
|||
[resource]
|
||||
script = ExtResource("4_8ybyj")
|
||||
name = "DEBUG Gfolfer"
|
||||
life = 100.0
|
||||
driver = ExtResource("1_sn8fd")
|
||||
iron = ExtResource("2_piku2")
|
||||
wedge = ExtResource("5_wm4ae")
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
class_name WorldPlayer extends Resource
|
||||
## Container for the state of the player within the world.
|
||||
|
||||
signal on_life_changed(new_value: float)
|
||||
|
||||
@export_range(0, 100) var life: float = 100.0:
|
||||
set(value):
|
||||
if value != life:
|
||||
life = value
|
||||
on_life_changed.emit(value)
|
||||
|
||||
@export_category("Profile")
|
||||
# TODO character select
|
||||
@export var name: String = "Gfolfer"
|
||||
@export var color: Color = Color("ff7070")
|
||||
|
||||
@export_category("Equipment")
|
||||
@export var driver: Club
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
class_name ShotHUD extends Control
|
||||
## HUD for main gameplay loop
|
||||
|
||||
@onready var power_bar: ProgressBar = %PowerBar
|
||||
@onready var power_bar: TextureProgressBar = %PowerBar
|
||||
@onready var curve_bar: ProgressBar = %CurveBar
|
||||
@onready var life_bar: TextureProgressBar = %LifeBar
|
||||
|
||||
@onready var club_selector: ClubSelector = %ClubSelector
|
||||
|
||||
|
@ -14,6 +15,8 @@ class_name ShotHUD extends Control
|
|||
@onready var _nice_animation: AnimationPlayer = %NiceAnimation
|
||||
@onready var _wasted_animation: AnimationPlayer = %WastedAnimation
|
||||
|
||||
@onready var _player_name: Label = %PlayerName
|
||||
|
||||
@onready var _state: AnimationNodeStateMachinePlayback = hud_state_machine["parameters/playback"]
|
||||
|
||||
|
||||
|
@ -21,7 +24,10 @@ class_name ShotHUD extends Control
|
|||
func set_state_for_player(player: WorldPlayer) -> void:
|
||||
print_debug("Setting HUD for player ", player.name)
|
||||
club_selector.set_state_for_player(player)
|
||||
# TODO life
|
||||
_player_name.text = player.name
|
||||
# TODO animate on life loss?
|
||||
life_bar.value = player.life
|
||||
life_bar.tint_progress = player.color
|
||||
# TODO special equipment
|
||||
# TODO abilities
|
||||
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
[gd_scene load_steps=28 format=3 uid="uid://c4ifdiohng830"]
|
||||
[gd_scene load_steps=34 format=3 uid="uid://c4ifdiohng830"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/ui/shot_hud/shot_hud.gd" id="1_x5b4c"]
|
||||
[ext_resource type="Shader" path="res://src/shaders/canvas_retro.gdshader" id="1_ybxxp"]
|
||||
[ext_resource type="PackedScene" uid="uid://445qd7m4qe2j" path="res://src/ui/shot_hud/club_selector/club_selector.tscn" id="2_1hdub"]
|
||||
[ext_resource type="Script" path="res://src/ui/decorations/rumbler.gd" id="3_6groq"]
|
||||
[ext_resource type="Texture2D" uid="uid://b5812y3pmmgg5" path="res://assets/ui/gauge_patch.png" id="4_5kcpe"]
|
||||
[ext_resource type="Texture2D" uid="uid://76fjx2ukavqe" path="res://assets/ui/power_gauge_fill.png" id="5_3i1yq"]
|
||||
[ext_resource type="Texture2D" uid="uid://4a8tvjgwegv3" path="res://assets/ui/power_gauge_tab.png" id="6_sw48q"]
|
||||
[ext_resource type="FontFile" uid="uid://dsa0oh7c0h4pu" path="res://assets/fonts/Racing_Sans_One/RacingSansOne-Regular.ttf" id="8_bejx4"]
|
||||
[ext_resource type="Texture2D" uid="uid://bvwh0yunmvirp" path="res://assets/ui/lifebar_patch.png" id="9_4f1d7"]
|
||||
[ext_resource type="Texture2D" uid="uid://dtdqninlnu10o" path="res://assets/ui/lifebar_fill_grey.png" id="10_130v7"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_3xds6"]
|
||||
resource_name = "RESET"
|
||||
|
@ -281,7 +287,7 @@ length = 0.001
|
|||
tracks/0/type = "bezier"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:value")
|
||||
tracks/0/path = NodePath("../Rumbler/PowerBar:value")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
|
@ -292,7 +298,7 @@ tracks/0/keys = {
|
|||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("%PowerBar/..:intensity")
|
||||
tracks/1/path = NodePath("../Rumbler:intensity")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
|
@ -308,18 +314,18 @@ length = 1.618
|
|||
tracks/0/type = "bezier"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:value")
|
||||
tracks/0/path = NodePath("../Rumbler/PowerBar:value")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.233333, 0.0884774, 1, -0.267469, -0.483539, 0.25, 0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.233333, 0.598765, 1, -0.351333, -0.246032, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 1.618)
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("%PowerBar/..:intensity")
|
||||
tracks/1/path = NodePath("../Rumbler:intensity")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
|
@ -561,22 +567,43 @@ grow_horizontal = 2
|
|||
grow_vertical = 2
|
||||
script = ExtResource("3_6groq")
|
||||
|
||||
[node name="PowerBar" type="ProgressBar" parent="ShotGauges/PowerGauge/Rumbler"]
|
||||
[node name="PowerBar" type="TextureProgressBar" parent="ShotGauges/PowerGauge/Rumbler"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(30, 0)
|
||||
visible = false
|
||||
texture_filter = 5
|
||||
custom_minimum_size = Vector2(64, 0)
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 1
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
fill_mode = 2
|
||||
nine_patch_stretch = true
|
||||
stretch_margin_left = 16
|
||||
stretch_margin_top = 16
|
||||
stretch_margin_right = 16
|
||||
stretch_margin_bottom = 16
|
||||
texture_under = ExtResource("4_5kcpe")
|
||||
texture_progress = ExtResource("5_3i1yq")
|
||||
|
||||
[node name="TitleTab" type="TextureRect" parent="ShotGauges/PowerGauge/Rumbler/PowerBar"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -8.0
|
||||
offset_right = 19.0
|
||||
offset_bottom = 48.0
|
||||
grow_horizontal = 0
|
||||
texture = ExtResource("6_sw48q")
|
||||
stretch_mode = 2
|
||||
|
||||
[node name="PowerAnimation" type="AnimationPlayer" parent="ShotGauges/PowerGauge"]
|
||||
unique_name_in_owner = true
|
||||
root_node = NodePath("../Rumbler/PowerBar")
|
||||
root_node = NodePath(".")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_coah5")
|
||||
}
|
||||
|
@ -634,3 +661,53 @@ unique_name_in_owner = true
|
|||
root_node = NodePath("%HUDStateMachine/..")
|
||||
tree_root = SubResource("AnimationNodeStateMachine_osrbp")
|
||||
anim_player = NodePath("../HUDAnimation")
|
||||
|
||||
[node name="SouthWest" type="MarginContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.333
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -40.0
|
||||
offset_right = 40.0
|
||||
grow_vertical = 0
|
||||
theme_override_constants/margin_left = 16
|
||||
theme_override_constants/margin_bottom = 16
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="SouthWest"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = -8
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="SouthWest/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Spacer" type="Control" parent="SouthWest/VBoxContainer/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(24, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="PlayerName" type="Label" parent="SouthWest/VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/shadow_offset_x = 3
|
||||
theme_override_constants/shadow_offset_y = 0
|
||||
theme_override_constants/outline_size = 2
|
||||
theme_override_constants/shadow_outline_size = 2
|
||||
theme_override_fonts/font = ExtResource("8_bejx4")
|
||||
theme_override_font_sizes/font_size = 32
|
||||
text = "PLAYER NAME"
|
||||
|
||||
[node name="LifeBar" type="TextureProgressBar" parent="SouthWest/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 48)
|
||||
layout_mode = 2
|
||||
min_value = -4.0
|
||||
step = 0.01
|
||||
nine_patch_stretch = true
|
||||
stretch_margin_left = 32
|
||||
stretch_margin_top = 16
|
||||
stretch_margin_right = 32
|
||||
stretch_margin_bottom = 16
|
||||
texture_under = ExtResource("9_4f1d7")
|
||||
texture_progress = ExtResource("10_130v7")
|
||||
|
|
Loading…
Reference in New Issue