UI improvements. Add stamina indicator for future

This commit is contained in:
Dustin 2025-04-05 09:22:52 -07:00
parent 60ee655001
commit 1a82c2bdf0
5 changed files with 79 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Staminabar-Indicator.png-788a1183a5b10acd59c2a4cfb5ea2038.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/UI/Staminabar-Indicator.png"
dest_files=[ "res://.import/Staminabar-Indicator.png-788a1183a5b10acd59c2a4cfb5ea2038.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -6,6 +6,7 @@ extends Node
# var b = "text" # var b = "text"
var player_position: Vector2 var player_position: Vector2
var player_health: int var player_health: int
var player_stamina: int
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://icon.png" type="Texture" id=1] [ext_resource path="res://icon.png" type="Texture" id=1]
[ext_resource path="res://assets/Fonts/QuinqueFive.tres" type="DynamicFont" id=2] [ext_resource path="res://assets/Fonts/QuinqueFive.tres" type="DynamicFont" id=2]
@ -6,6 +6,7 @@
[ext_resource path="res://assets/UI/Healthbar.png" type="Texture" id=4] [ext_resource path="res://assets/UI/Healthbar.png" type="Texture" id=4]
[ext_resource path="res://src/ui/HealthBar.gd" type="Script" id=5] [ext_resource path="res://src/ui/HealthBar.gd" type="Script" id=5]
[ext_resource path="res://assets/UI/Healthbar-Indicator.png" type="Texture" id=6] [ext_resource path="res://assets/UI/Healthbar-Indicator.png" type="Texture" id=6]
[ext_resource path="res://assets/UI/Staminabar-Indicator.png" type="Texture" id=7]
[node name="HUD" type="CanvasLayer"] [node name="HUD" type="CanvasLayer"]
pause_mode = 2 pause_mode = 2
@ -13,7 +14,6 @@ layer = 2
script = ExtResource( 3 ) script = ExtResource( 3 )
[node name="PanelContainer" type="PanelContainer" parent="."] [node name="PanelContainer" type="PanelContainer" parent="."]
visible = false
margin_left = 2.0 margin_left = 2.0
margin_top = 2.0 margin_top = 2.0
margin_right = 318.0 margin_right = 318.0
@ -61,6 +61,17 @@ texture_progress = ExtResource( 6 )
texture_progress_offset = Vector2( 1, 1 ) texture_progress_offset = Vector2( 1, 1 )
script = ExtResource( 5 ) script = ExtResource( 5 )
[node name="StaminaBar" type="TextureProgress" parent="."]
margin_left = 2.0
margin_top = 14.0
margin_right = 104.0
margin_bottom = 14.0
value = 50.0
texture_under = ExtResource( 4 )
texture_progress = ExtResource( 7 )
texture_progress_offset = Vector2( 1, 1 )
script = ExtResource( 5 )
[node name="Debug" type="Label" parent="."] [node name="Debug" type="Label" parent="."]
anchor_left = 1.0 anchor_left = 1.0
anchor_right = 1.0 anchor_right = 1.0
@ -71,3 +82,17 @@ margin_bottom = 17.0
custom_fonts/font = ExtResource( 2 ) custom_fonts/font = ExtResource( 2 )
text = "Foo" text = "Foo"
align = 2 align = 2
[node name="InventoryContainer" type="HSplitContainer" parent="."]
margin_right = 40.0
margin_bottom = 40.0
split_offset = 1
[node name="Primary" type="TextureRect" parent="InventoryContainer"]
margin_right = 1.0
margin_bottom = 40.0
[node name="Secondary" type="TextureRect" parent="InventoryContainer"]
margin_left = 13.0
margin_right = 40.0
margin_bottom = 40.0

16
src/ui/StaminaBar.gd Normal file
View File

@ -0,0 +1,16 @@
extends TextureProgress
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
value = PlayerInfo.player_stamina