There's now an hp status indicator 'doll' when you click on it your host (character) will tell you how they're doing for HP.

This commit is contained in:
Zed A. Shaw 2025-04-26 00:57:23 -04:00
parent dac9b1b3de
commit ad1d08ca96
11 changed files with 37 additions and 7 deletions

View file

@ -12,7 +12,9 @@ namespace gui {
{
$gui.position(COMBAT_UI_X, COMBAT_UI_Y, COMBAT_UI_WIDTH, COMBAT_UI_HEIGHT);
$gui.layout(
"[*%(100,150)button_0 | *%(100,150)button_1 | *%(100,150)button_2 | *%(100,150)button_3]");
"[button_0 | button_1 | button_2 | button_3"
"|button_4 | button_5 | button_6 | hp_gauge ]"
);
}
DinkyECS::Entity CombatUI::make_button(std::string name, std::wstring label, Events::GUI event, int action, const std::string &icon_name,
@ -24,7 +26,7 @@ namespace gui {
// $gui.set<Rectangle>(button, {});
// $gui.set<Label>(button, {label});
$gui.set<Sound>(button, {sound});
$gui.set<Effect>(button, {.duration=1.0f, .name=effect_name});
$gui.set<Effect>(button, {.duration=0.5f, .name=effect_name});
$gui.set<Clickable>(button,
guecs::make_action(*$level.world, event, {action}));
@ -41,8 +43,6 @@ namespace gui {
std::wstring label = fmt::format(L"Attack {}", slot+1);
auto& ritual = the_belt.get(slot);
using enum combat::RitualElement;
switch(ritual.element) {
@ -52,7 +52,7 @@ namespace gui {
break;
case LIGHTNING:
make_button(name, label, Events::GUI::ATTACK,
slot, "stone_doll_cursed-64", "electric_shock_01", "lightning");
slot, "pocket_watch-64", "electric_shock_01", "lightning");
break;
default:
make_button(name, label, Events::GUI::ATTACK,
@ -61,6 +61,11 @@ namespace gui {
}
}
auto hp_gauge = $gui.entity("hp_gauge");
$gui.set<Sprite>(hp_gauge, {"stone_doll_cursed-64"});
$gui.set<Clickable>(hp_gauge,
guecs::make_action(*$level.world, Events::GUI::HP_STATUS, {}));
$gui.init();
}