Player ui stuff
This commit is contained in:
@@ -69,10 +69,6 @@ namespace GameJamDungeon
|
|||||||
|
|
||||||
[Node] public Label VTNumber { get; set; } = default!;
|
[Node] public Label VTNumber { get; set; } = default!;
|
||||||
|
|
||||||
[Node] public ProgressBar HPBar { get; set; } = default!;
|
|
||||||
|
|
||||||
[Node] public ProgressBar VTBar { get; set; } = default!;
|
|
||||||
|
|
||||||
[Node] public IArea3D CollisionDetector { get; set; } = default!;
|
[Node] public IArea3D CollisionDetector { get; set; } = default!;
|
||||||
|
|
||||||
private AutoProp<double> _currentHP { get; set; } = default!;
|
private AutoProp<double> _currentHP { get; set; } = default!;
|
||||||
@@ -103,11 +99,6 @@ namespace GameJamDungeon
|
|||||||
_currentHP.Sync += OnHPChanged;
|
_currentHP.Sync += OnHPChanged;
|
||||||
_currentVT.Sync += OnVTChanged;
|
_currentVT.Sync += OnVTChanged;
|
||||||
|
|
||||||
HPBar.MaxValue = PlayerStatInfo.MaximumHP;
|
|
||||||
HPBar.Value = _currentHP.Value;
|
|
||||||
VTBar.MaxValue = PlayerStatInfo.MaximumVT;
|
|
||||||
VTBar.Value = _currentVT.Value;
|
|
||||||
|
|
||||||
HealthTimer.Timeout += OnHealthTimerTimeout;
|
HealthTimer.Timeout += OnHealthTimerTimeout;
|
||||||
CollisionDetector.AreaEntered += OnEnemyHitBoxEntered;
|
CollisionDetector.AreaEntered += OnEnemyHitBoxEntered;
|
||||||
}
|
}
|
||||||
@@ -222,8 +213,7 @@ namespace GameJamDungeon
|
|||||||
|
|
||||||
private void OnHPChanged(double newHP)
|
private void OnHPChanged(double newHP)
|
||||||
{
|
{
|
||||||
HPNumber.Text = Mathf.RoundToInt(newHP).ToString();
|
HPNumber.Text = $"{Mathf.RoundToInt(newHP)}/{PlayerStatInfo.MaximumHP}";
|
||||||
HPBar.Value = newHP;
|
|
||||||
|
|
||||||
if (newHP <= 0.0)
|
if (newHP <= 0.0)
|
||||||
{
|
{
|
||||||
@@ -234,8 +224,7 @@ namespace GameJamDungeon
|
|||||||
|
|
||||||
private void OnVTChanged(int newVT)
|
private void OnVTChanged(int newVT)
|
||||||
{
|
{
|
||||||
VTNumber.Text = newVT.ToString();
|
VTNumber.Text = $"{newVT}/{PlayerStatInfo.MaximumVT}";
|
||||||
VTBar.Value = newVT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPlayerPositionUpdated(Vector3 globalPosition) => GlobalPosition = globalPosition;
|
private void OnPlayerPositionUpdated(Vector3 globalPosition) => GlobalPosition = globalPosition;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=21 format=3 uid="uid://cfecvvav8kkp6"]
|
[gd_scene load_steps=22 format=3 uid="uid://cfecvvav8kkp6"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://src/player/Player.cs" id="1_xcol5"]
|
[ext_resource type="Script" path="res://src/player/Player.cs" id="1_xcol5"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bokx3h8kfdo5i" path="res://src/player/slash_0000_Classic_30.png" id="2_la11l"]
|
[ext_resource type="Texture2D" uid="uid://bokx3h8kfdo5i" path="res://src/player/slash_0000_Classic_30.png" id="2_la11l"]
|
||||||
@@ -9,6 +9,9 @@
|
|||||||
[ext_resource type="Texture2D" uid="uid://bodfblud4kea3" path="res://src/player/slash_0003_Classic_27.png" id="5_eebal"]
|
[ext_resource type="Texture2D" uid="uid://bodfblud4kea3" path="res://src/player/slash_0003_Classic_27.png" id="5_eebal"]
|
||||||
[ext_resource type="Texture2D" uid="uid://de55prolicl0u" path="res://src/player/slash_0004_Classic_26.png" id="6_ngag5"]
|
[ext_resource type="Texture2D" uid="uid://de55prolicl0u" path="res://src/player/slash_0004_Classic_26.png" id="6_ngag5"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bp0msic3uk3kc" path="res://src/player/slash_0005_Layer-1.png" id="7_tp5uu"]
|
[ext_resource type="Texture2D" uid="uid://bp0msic3uk3kc" path="res://src/player/slash_0005_Layer-1.png" id="7_tp5uu"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://hg2kraa5nrnl" path="res://src/ui/textures/blank level symbol.png" id="10_rsd7v"]
|
||||||
|
[ext_resource type="LabelSettings" uid="uid://cuuo43x72xcsc" path="res://src/ui/label_settings/MainTextBold.tres" id="11_6svf8"]
|
||||||
|
[ext_resource type="LabelSettings" uid="uid://dupifadnagodp" path="res://src/ui/label_settings/MainTextRegular.tres" id="12_f4uqk"]
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_up0v1"]
|
[sub_resource type="Resource" id="Resource_up0v1"]
|
||||||
script = ExtResource("2_n88di")
|
script = ExtResource("2_n88di")
|
||||||
@@ -121,12 +124,6 @@ animations = [{
|
|||||||
"speed": 12.0
|
"speed": 12.0
|
||||||
}]
|
}]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_kxbln"]
|
|
||||||
bg_color = Color(0, 0.411765, 0, 1)
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_onron"]
|
|
||||||
bg_color = Color(0, 0.411765, 0, 1)
|
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody3D"]
|
[node name="Player" type="CharacterBody3D"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.381018, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.381018, 0)
|
||||||
collision_layer = 38
|
collision_layer = 38
|
||||||
@@ -190,46 +187,80 @@ process_mode = 1
|
|||||||
wait_time = 3.0
|
wait_time = 3.0
|
||||||
autostart = true
|
autostart = true
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
[node name="PlayerInfoUI" type="MarginContainer" parent="."]
|
||||||
anchors_preset = 15
|
offset_right = 629.0
|
||||||
anchor_right = 1.0
|
offset_bottom = 256.0
|
||||||
anchor_bottom = 1.0
|
theme_override_constants/margin_left = 32
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
theme_override_constants/margin_left = 20
|
|
||||||
theme_override_constants/margin_top = 20
|
|
||||||
theme_override_constants/margin_right = 20
|
|
||||||
theme_override_constants/margin_bottom = 20
|
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
[node name="HBoxContainer" type="HBoxContainer" parent="PlayerInfoUI"]
|
||||||
custom_minimum_size = Vector2(400, 0)
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 0
|
|
||||||
size_flags_vertical = 0
|
|
||||||
|
|
||||||
[node name="HPNumber" type="Label" parent="MarginContainer/VBoxContainer"]
|
[node name="CenterContainer" type="CenterContainer" parent="PlayerInfoUI/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="TextureRect" type="TextureRect" parent="PlayerInfoUI/HBoxContainer/CenterContainer"]
|
||||||
|
custom_minimum_size = Vector2(128, 128)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 3
|
||||||
|
texture = ExtResource("10_rsd7v")
|
||||||
|
expand_mode = 1
|
||||||
|
stretch_mode = 4
|
||||||
|
|
||||||
|
[node name="Level" type="Label" parent="PlayerInfoUI/HBoxContainer/CenterContainer"]
|
||||||
|
custom_minimum_size = Vector2(80, 80)
|
||||||
|
layout_mode = 2
|
||||||
|
text = "99"
|
||||||
|
label_settings = ExtResource("11_6svf8")
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="VBox" type="VBoxContainer" parent="PlayerInfoUI/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
size_flags_vertical = 4
|
||||||
|
theme_override_constants/separation = 15
|
||||||
|
|
||||||
|
[node name="HBox" type="HBoxContainer" parent="PlayerInfoUI/HBoxContainer/VBox"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="HP" type="Label" parent="PlayerInfoUI/HBoxContainer/VBox/HBox"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "HP: "
|
||||||
|
label_settings = ExtResource("11_6svf8")
|
||||||
|
|
||||||
|
[node name="ReferenceRect" type="ReferenceRect" parent="PlayerInfoUI/HBoxContainer/VBox/HBox"]
|
||||||
|
custom_minimum_size = Vector2(30, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
border_width = 0.0
|
||||||
|
|
||||||
|
[node name="HPNumber" type="Label" parent="PlayerInfoUI/HBoxContainer/VBox/HBox"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "HP: inf/inf"
|
text = "222/222"
|
||||||
|
label_settings = ExtResource("12_f4uqk")
|
||||||
|
|
||||||
[node name="HPBar" type="ProgressBar" parent="MarginContainer/VBoxContainer"]
|
[node name="HBox2" type="HBoxContainer" parent="PlayerInfoUI/HBoxContainer/VBox"]
|
||||||
unique_name_in_owner = true
|
|
||||||
custom_minimum_size = Vector2(0, 25)
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_styles/background = SubResource("StyleBoxFlat_kxbln")
|
|
||||||
show_percentage = false
|
|
||||||
|
|
||||||
[node name="VTNumber" type="Label" parent="MarginContainer/VBoxContainer"]
|
[node name="VT" type="Label" parent="PlayerInfoUI/HBoxContainer/VBox/HBox2"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "VT:"
|
||||||
|
label_settings = ExtResource("11_6svf8")
|
||||||
|
|
||||||
|
[node name="ReferenceRect" type="ReferenceRect" parent="PlayerInfoUI/HBoxContainer/VBox/HBox2"]
|
||||||
|
custom_minimum_size = Vector2(30, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
border_width = 0.0
|
||||||
|
|
||||||
|
[node name="VTNumber" type="Label" parent="PlayerInfoUI/HBoxContainer/VBox/HBox2"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "VT: inf/inf"
|
text = "444/444"
|
||||||
|
label_settings = ExtResource("12_f4uqk")
|
||||||
|
|
||||||
[node name="VTBar" type="ProgressBar" parent="MarginContainer/VBoxContainer"]
|
[node name="TextureButton" type="TextureButton" parent="PlayerInfoUI"]
|
||||||
unique_name_in_owner = true
|
|
||||||
custom_minimum_size = Vector2(0, 25)
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_styles/background = SubResource("StyleBoxFlat_onron")
|
|
||||||
show_percentage = false
|
|
||||||
|
|
||||||
[node name="Marker3D" type="Marker3D" parent="."]
|
[node name="Marker3D" type="Marker3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2.70201)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2.70201)
|
||||||
|
|||||||
@@ -4,5 +4,5 @@
|
|||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
font = ExtResource("1_4xbcf")
|
font = ExtResource("1_4xbcf")
|
||||||
font_size = 36
|
font_size = 32
|
||||||
font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||||
|
|||||||
@@ -4,5 +4,5 @@
|
|||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
font = ExtResource("1_u174r")
|
font = ExtResource("1_u174r")
|
||||||
font_size = 36
|
font_size = 32
|
||||||
font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||||
|
|||||||
BIN
src/ui/textures/blank level symbol.png
Normal file
BIN
src/ui/textures/blank level symbol.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
34
src/ui/textures/blank level symbol.png.import
Normal file
34
src/ui/textures/blank level symbol.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://hg2kraa5nrnl"
|
||||||
|
path="res://.godot/imported/blank level symbol.png-14e7d3eb360d529d659ec2284ee12ca4.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://src/ui/textures/blank level symbol.png"
|
||||||
|
dest_files=["res://.godot/imported/blank level symbol.png-14e7d3eb360d529d659ec2284ee12ca4.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
|
||||||
Reference in New Issue
Block a user