diff --git a/asset_dev/UI/gauge_patch.xcf b/asset_dev/UI/gauge_patch.xcf new file mode 100644 index 0000000..b1708b4 Binary files /dev/null and b/asset_dev/UI/gauge_patch.xcf differ diff --git a/asset_dev/UI/gauge_patch_large.xcf b/asset_dev/UI/gauge_patch_large.xcf new file mode 100644 index 0000000..cff75cf Binary files /dev/null and b/asset_dev/UI/gauge_patch_large.xcf differ diff --git a/asset_dev/UI/lifebar_patch.xcf b/asset_dev/UI/lifebar_patch.xcf new file mode 100644 index 0000000..205fca5 Binary files /dev/null and b/asset_dev/UI/lifebar_patch.xcf differ diff --git a/asset_dev/UI/power_gauge_tab.xcf b/asset_dev/UI/power_gauge_tab.xcf new file mode 100644 index 0000000..3f73d3c Binary files /dev/null and b/asset_dev/UI/power_gauge_tab.xcf differ diff --git a/assets/ui/gauge_patch.png b/assets/ui/gauge_patch.png new file mode 100644 index 0000000..123d714 --- /dev/null +++ b/assets/ui/gauge_patch.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7b36366a7e401222e6cddd81e07f9da3f09ddbc2e3a67a9381938e8f9568003 +size 917 diff --git a/assets/ui/gauge_patch.png.import b/assets/ui/gauge_patch.png.import new file mode 100644 index 0000000..eb12da2 --- /dev/null +++ b/assets/ui/gauge_patch.png.import @@ -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 diff --git a/assets/ui/lifebar_fill_grey.png b/assets/ui/lifebar_fill_grey.png new file mode 100644 index 0000000..87b1986 --- /dev/null +++ b/assets/ui/lifebar_fill_grey.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5799039d5ae50304dc4fe7608ea5454b2676d36170d736240fbef71254e589f3 +size 2196 diff --git a/assets/ui/lifebar_fill_grey.png.import b/assets/ui/lifebar_fill_grey.png.import new file mode 100644 index 0000000..b2d910f --- /dev/null +++ b/assets/ui/lifebar_fill_grey.png.import @@ -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 diff --git a/assets/ui/lifebar_patch.png b/assets/ui/lifebar_patch.png new file mode 100644 index 0000000..c571e90 --- /dev/null +++ b/assets/ui/lifebar_patch.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8eaaf2f5c8b2ca563e98b6b0fdf1be835e65b6279be2f690138da5753ddc6c0e +size 1121 diff --git a/assets/ui/lifebar_patch.png.import b/assets/ui/lifebar_patch.png.import new file mode 100644 index 0000000..adcb043 --- /dev/null +++ b/assets/ui/lifebar_patch.png.import @@ -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 diff --git a/assets/ui/power_gauge_fill.png b/assets/ui/power_gauge_fill.png new file mode 100644 index 0000000..a106a45 --- /dev/null +++ b/assets/ui/power_gauge_fill.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3b1fe74605c1da390924fce16d663092d6f2c910966a32fb3ba429d4d46d53d +size 665 diff --git a/assets/ui/power_gauge_fill.png.import b/assets/ui/power_gauge_fill.png.import new file mode 100644 index 0000000..558a5b3 --- /dev/null +++ b/assets/ui/power_gauge_fill.png.import @@ -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 diff --git a/assets/ui/power_gauge_tab.png b/assets/ui/power_gauge_tab.png new file mode 100644 index 0000000..ecc6fc9 --- /dev/null +++ b/assets/ui/power_gauge_tab.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc2a5b9ed04b1cb7235d495f8d70bdd21744b901b7bedd5ff74d68d751bffcac +size 1152 diff --git a/assets/ui/power_gauge_tab.png.import b/assets/ui/power_gauge_tab.png.import new file mode 100644 index 0000000..c020de1 --- /dev/null +++ b/assets/ui/power_gauge_tab.png.import @@ -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 diff --git a/src/player/debug_player.tres b/src/player/debug_player.tres index 7a431d3..8eaef6f 100644 --- a/src/player/debug_player.tres +++ b/src/player/debug_player.tres @@ -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") diff --git a/src/player/world_player.gd b/src/player/world_player.gd index 3754757..ace2d5d 100644 --- a/src/player/world_player.gd +++ b/src/player/world_player.gd @@ -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 diff --git a/src/ui/shot_hud/shot_hud.gd b/src/ui/shot_hud/shot_hud.gd index 6bc1810..1e0e9d9 100644 --- a/src/ui/shot_hud/shot_hud.gd +++ b/src/ui/shot_hud/shot_hud.gd @@ -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 diff --git a/src/ui/shot_hud/shot_hud.tscn b/src/ui/shot_hud/shot_hud.tscn index 0abc3b0..af8c3e3 100644 --- a/src/ui/shot_hud/shot_hud.tscn +++ b/src/ui/shot_hud/shot_hud.tscn @@ -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")