added basic player UI
This commit is contained in:
parent
1ba24d1faf
commit
a16601fa1d
15 changed files with 165 additions and 72 deletions
|
|
@ -1,19 +0,0 @@
|
|||
namespace Dancer;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public sealed partial class DashPointBar : ProgressBar
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Export] private Player Player { get; set; } = null!;
|
||||
|
||||
public void OnReady() => SetProcess(true);
|
||||
|
||||
public void OnProcess(double delta)
|
||||
{
|
||||
MinValue = 0;
|
||||
MaxValue = Player.MaxDashPoints;
|
||||
Value = Player.DashPoints;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://i2ts2auxd3na
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
namespace Dancer;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public sealed partial class PlayerHealthBar : ProgressBar
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Export] private Player Player { get; set; } = null!;
|
||||
|
||||
public void OnReady() => SetProcess(true);
|
||||
|
||||
public void OnProcess(double delta)
|
||||
{
|
||||
MinValue = 0;
|
||||
MaxValue = Player.MaxHealth;
|
||||
Value = Player.Health;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://i5v0sfow12sr
|
||||
BIN
src/player/player_old.aseprite
(Stored with Git LFS)
BIN
src/player/player_old.aseprite
(Stored with Git LFS)
Binary file not shown.
35
src/player/ui/PlayerHud.cs
Normal file
35
src/player/ui/PlayerHud.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
namespace Dancer;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class PlayerHud : Control
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Export] private Player Player { get; set; } = null!;
|
||||
|
||||
[Node] private TextureProgressBar HpBar { get; set; } = null!;
|
||||
[Node] private TextureProgressBar EnergyBar0 { get; set; } = null!;
|
||||
[Node] private TextureProgressBar EnergyBar1 { get; set; } = null!;
|
||||
[Node] private TextureProgressBar EnergyBar2 { get; set; } = null!;
|
||||
|
||||
public void OnReady() => SetProcess(true);
|
||||
|
||||
public void OnProcess(double delta)
|
||||
{
|
||||
HpBar.MinValue = 0f;
|
||||
HpBar.MaxValue = Player.MaxHealth;
|
||||
HpBar.Value = Player.Health;
|
||||
|
||||
EnergyBar0.MinValue = 0f;
|
||||
EnergyBar0.MaxValue = 1f;
|
||||
EnergyBar0.Value = Mathf.Clamp(Player.DashPoints - 0f, 0f, 1f);
|
||||
|
||||
EnergyBar1.MinValue = 0f;
|
||||
EnergyBar1.MaxValue = 1f;
|
||||
EnergyBar1.Value = Mathf.Clamp(Player.DashPoints - 1f, 0f, 1f);
|
||||
|
||||
EnergyBar2.MinValue = 0f;
|
||||
EnergyBar2.MaxValue = 1f;
|
||||
EnergyBar2.Value = Mathf.Clamp(Player.DashPoints - 2f, 0f, 1f);
|
||||
}
|
||||
}
|
||||
1
src/player/ui/PlayerHud.cs.uid
Normal file
1
src/player/ui/PlayerHud.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dsbiwhvdat5ul
|
||||
BIN
src/player/ui/energy_bar.aseprite
(Stored with Git LFS)
Normal file
BIN
src/player/ui/energy_bar.aseprite
(Stored with Git LFS)
Normal file
Binary file not shown.
21
src/player/ui/energy_bar.aseprite.import
Normal file
21
src/player/ui/energy_bar.aseprite.import
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
[remap]
|
||||
|
||||
importer="aseprite_wizard.plugin.static-texture"
|
||||
type="PortableCompressedTexture2D"
|
||||
uid="uid://mc1svittoh76"
|
||||
path="res://.godot/imported/energy_bar.aseprite-5b8ca4afaff2301251090a90413e99f9.res"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/player/ui/energy_bar.aseprite"
|
||||
dest_files=["res://.godot/imported/energy_bar.aseprite-5b8ca4afaff2301251090a90413e99f9.res"]
|
||||
|
||||
[params]
|
||||
|
||||
layer/exclude_layers_pattern=""
|
||||
layer/only_visible_layers=false
|
||||
layer/split_layers=false
|
||||
first_frame_only=true
|
||||
sheet/sheet_type="packed"
|
||||
sheet/sheet_columns=12
|
||||
sheet/scale=1
|
||||
BIN
src/player/ui/hp_bar.aseprite
(Stored with Git LFS)
Normal file
BIN
src/player/ui/hp_bar.aseprite
(Stored with Git LFS)
Normal file
Binary file not shown.
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
importer="aseprite_wizard.plugin.static-texture"
|
||||
type="PortableCompressedTexture2D"
|
||||
uid="uid://ddaoshqpfh1t4"
|
||||
path="res://.godot/imported/player_old.aseprite-47ad749bdb952bbe0ea8d9f38e3427b5.res"
|
||||
uid="uid://b8bc8ahlqu0qv"
|
||||
path="res://.godot/imported/hp_bar.aseprite-ffb900533de34c8a616bd4c778a70ea7.res"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/player/player_old.aseprite"
|
||||
dest_files=["res://.godot/imported/player_old.aseprite-47ad749bdb952bbe0ea8d9f38e3427b5.res"]
|
||||
source_file="res://src/player/ui/hp_bar.aseprite"
|
||||
dest_files=["res://.godot/imported/hp_bar.aseprite-ffb900533de34c8a616bd4c778a70ea7.res"]
|
||||
|
||||
[params]
|
||||
|
||||
BIN
src/player/ui/player_hud.aseprite
(Stored with Git LFS)
Normal file
BIN
src/player/ui/player_hud.aseprite
(Stored with Git LFS)
Normal file
Binary file not shown.
21
src/player/ui/player_hud.aseprite.import
Normal file
21
src/player/ui/player_hud.aseprite.import
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
[remap]
|
||||
|
||||
importer="aseprite_wizard.plugin.static-texture"
|
||||
type="PortableCompressedTexture2D"
|
||||
uid="uid://ytvw63oqb6lf"
|
||||
path="res://.godot/imported/player_hud.aseprite-e0de957c13b015f06cc6272b33306712.res"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/player/ui/player_hud.aseprite"
|
||||
dest_files=["res://.godot/imported/player_hud.aseprite-e0de957c13b015f06cc6272b33306712.res"]
|
||||
|
||||
[params]
|
||||
|
||||
layer/exclude_layers_pattern=""
|
||||
layer/only_visible_layers=true
|
||||
layer/split_layers=false
|
||||
first_frame_only=true
|
||||
sheet/sheet_type="packed"
|
||||
sheet/sheet_columns=12
|
||||
sheet/scale=1
|
||||
68
src/player/ui/player_hud.tscn
Normal file
68
src/player/ui/player_hud.tscn
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
[gd_scene format=3 uid="uid://llohfwmma2hv"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dsbiwhvdat5ul" path="res://src/player/ui/PlayerHud.cs" id="1_580w7"]
|
||||
[ext_resource type="Texture2D" uid="uid://b8bc8ahlqu0qv" path="res://src/player/ui/hp_bar.aseprite" id="2_nuiq8"]
|
||||
[ext_resource type="Texture2D" uid="uid://ytvw63oqb6lf" path="res://src/player/ui/player_hud.aseprite" id="2_uku0i"]
|
||||
[ext_resource type="Texture2D" uid="uid://mc1svittoh76" path="res://src/player/ui/energy_bar.aseprite" id="3_580w7"]
|
||||
|
||||
[node name="PlayerHud" type="Control" unique_id=763981532]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
script = ExtResource("1_580w7")
|
||||
|
||||
[node name="PlayerHudBase" type="TextureRect" parent="." unique_id=400555418]
|
||||
layout_mode = 0
|
||||
offset_right = 64.0
|
||||
offset_bottom = 24.0
|
||||
texture = ExtResource("2_uku0i")
|
||||
|
||||
[node name="HpBar" type="TextureProgressBar" parent="." unique_id=1950685336]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 6.0
|
||||
offset_right = 60.0
|
||||
offset_bottom = 46.0
|
||||
value = 100.0
|
||||
texture_progress = ExtResource("2_nuiq8")
|
||||
|
||||
[node name="Control" type="Control" parent="." unique_id=302593641]
|
||||
anchors_preset = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 20.0
|
||||
offset_right = 48.0
|
||||
offset_bottom = 60.0
|
||||
|
||||
[node name="EnergyBar0" type="TextureProgressBar" parent="Control" unique_id=2122373484]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
max_value = 1.0
|
||||
step = 0.1
|
||||
value = 1.0
|
||||
texture_progress = ExtResource("3_580w7")
|
||||
|
||||
[node name="EnergyBar1" type="TextureProgressBar" parent="Control" unique_id=177919498]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
offset_left = 11.0
|
||||
offset_right = 51.0
|
||||
offset_bottom = 40.0
|
||||
max_value = 1.0
|
||||
step = 0.1
|
||||
value = 1.0
|
||||
texture_progress = ExtResource("3_580w7")
|
||||
|
||||
[node name="EnergyBar2" type="TextureProgressBar" parent="Control" unique_id=1462542424]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
offset_left = 22.0
|
||||
offset_right = 62.0
|
||||
offset_bottom = 40.0
|
||||
max_value = 1.0
|
||||
step = 0.1
|
||||
value = 0.5
|
||||
texture_progress = ExtResource("3_580w7")
|
||||
Loading…
Add table
Add a link
Reference in a new issue