added basic player UI
This commit is contained in:
parent
1ba24d1faf
commit
a16601fa1d
15 changed files with 165 additions and 72 deletions
|
|
@ -10,8 +10,7 @@
|
||||||
[ext_resource type="Theme" uid="uid://bybov1cpwtf7p" path="res://src/base_theme.tres" id="5_bs6l1"]
|
[ext_resource type="Theme" uid="uid://bybov1cpwtf7p" path="res://src/base_theme.tres" id="5_bs6l1"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cbjps58vfmyeb" path="res://src/level/background.aseprite" id="5_wqvko"]
|
[ext_resource type="Texture2D" uid="uid://cbjps58vfmyeb" path="res://src/level/background.aseprite" id="5_wqvko"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dg5wulm2tav4t" path="res://src/level/neon_box_selector.aseprite" id="5_y2hwx"]
|
[ext_resource type="Texture2D" uid="uid://dg5wulm2tav4t" path="res://src/level/neon_box_selector.aseprite" id="5_y2hwx"]
|
||||||
[ext_resource type="Script" uid="uid://i5v0sfow12sr" path="res://src/player/PlayerHealthBar.cs" id="6_pk08u"]
|
[ext_resource type="PackedScene" uid="uid://llohfwmma2hv" path="res://src/player/ui/player_hud.tscn" id="11_y2hwx"]
|
||||||
[ext_resource type="Script" uid="uid://i2ts2auxd3na" path="res://src/player/DashPointBar.cs" id="12_qiocs"]
|
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_qiocs"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_qiocs"]
|
||||||
texture = ExtResource("4_y2hwx")
|
texture = ExtResource("4_y2hwx")
|
||||||
|
|
@ -157,9 +156,6 @@ custom_data_layer_0/name = "is_water"
|
||||||
custom_data_layer_0/type = 1
|
custom_data_layer_0/type = 1
|
||||||
sources/2 = SubResource("TileSetAtlasSource_e2o6t")
|
sources/2 = SubResource("TileSetAtlasSource_e2o6t")
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2j2mp"]
|
|
||||||
bg_color = Color(0.7842881, 0.31957126, 0.8066615, 1)
|
|
||||||
|
|
||||||
[node name="Game" type="Node2D" unique_id=1186062666]
|
[node name="Game" type="Node2D" unique_id=1186062666]
|
||||||
script = ExtResource("1_kc8ui")
|
script = ExtResource("1_kc8ui")
|
||||||
|
|
||||||
|
|
@ -205,7 +201,7 @@ color = Color(0, 0, 0, 1)
|
||||||
[node name="UI" type="CanvasLayer" parent="." unique_id=884024747]
|
[node name="UI" type="CanvasLayer" parent="." unique_id=884024747]
|
||||||
layer = 20
|
layer = 20
|
||||||
|
|
||||||
[node name="Control" type="Control" parent="UI" unique_id=791343346]
|
[node name="HudRoot" type="Control" parent="UI" unique_id=791343346]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
|
|
@ -216,25 +212,10 @@ mouse_filter = 1
|
||||||
theme = ExtResource("5_bs6l1")
|
theme = ExtResource("5_bs6l1")
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="PlayerHealthBar" type="ProgressBar" parent="UI/Control" unique_id=1470557052 node_paths=PackedStringArray("Player")]
|
[node name="PlayerHud" parent="UI/HudRoot" unique_id=763981532 node_paths=PackedStringArray("Player") instance=ExtResource("11_y2hwx")]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
offset_left = 32.0
|
offset_left = 48.0
|
||||||
offset_top = 16.0
|
offset_top = 16.0
|
||||||
offset_right = 170.0
|
offset_right = 88.0
|
||||||
offset_bottom = 29.0
|
offset_bottom = 56.0
|
||||||
mouse_filter = 2
|
|
||||||
value = 50.0
|
|
||||||
script = ExtResource("6_pk08u")
|
|
||||||
Player = NodePath("../../../World/Player")
|
|
||||||
|
|
||||||
[node name="DashPointBar" type="ProgressBar" parent="UI/Control" unique_id=1441382612 node_paths=PackedStringArray("Player")]
|
|
||||||
layout_mode = 1
|
|
||||||
offset_left = 32.0
|
|
||||||
offset_top = 48.0
|
|
||||||
offset_right = 170.0
|
|
||||||
offset_bottom = 61.0
|
|
||||||
mouse_filter = 2
|
|
||||||
theme_override_styles/fill = SubResource("StyleBoxFlat_2j2mp")
|
|
||||||
value = 50.0
|
|
||||||
script = ExtResource("12_qiocs")
|
|
||||||
Player = NodePath("../../../World/Player")
|
Player = NodePath("../../../World/Player")
|
||||||
|
|
|
||||||
|
|
@ -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"
|
importer="aseprite_wizard.plugin.static-texture"
|
||||||
type="PortableCompressedTexture2D"
|
type="PortableCompressedTexture2D"
|
||||||
uid="uid://ddaoshqpfh1t4"
|
uid="uid://b8bc8ahlqu0qv"
|
||||||
path="res://.godot/imported/player_old.aseprite-47ad749bdb952bbe0ea8d9f38e3427b5.res"
|
path="res://.godot/imported/hp_bar.aseprite-ffb900533de34c8a616bd4c778a70ea7.res"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://src/player/player_old.aseprite"
|
source_file="res://src/player/ui/hp_bar.aseprite"
|
||||||
dest_files=["res://.godot/imported/player_old.aseprite-47ad749bdb952bbe0ea8d9f38e3427b5.res"]
|
dest_files=["res://.godot/imported/hp_bar.aseprite-ffb900533de34c8a616bd4c778a70ea7.res"]
|
||||||
|
|
||||||
[params]
|
[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