Setup for showing an in-combat icon and made it so I wait until the animation is done playing, as games do.

This commit is contained in:
Zed A. Shaw 2026-05-27 12:15:29 -04:00
parent 6f9e8a3ed4
commit af69bd2286
3 changed files with 17 additions and 2 deletions

View file

@ -75,11 +75,11 @@ namespace gui {
}
void FSM::ATTACKING(Event ev, std::any data) {
// if(!$main_ui.hands_playing()) {
if(!$main_ui.hands_playing()) {
// run combat one more time
$systems.runCombat(0);
state(State::IDLE);
// }
}
}
void FSM::ROTATING(Event) {

View file

@ -144,6 +144,10 @@ namespace gui {
if(!$hand_anim.playing) $hand_anim.play();
}
bool MainUI::hands_playing() {
return $hand_anim.playing;
}
void MainUI::render_hands() {
if($hand_anim.playing) {
$hand_anim.update();
@ -152,4 +156,12 @@ namespace gui {
$window.draw(*$hand.sprite);
}
}
void MainUI::show_combat() {
$overlay_ui.show_sprite("top_right", "combat_active");
}
void MainUI::close_combat() {
$overlay_ui.close_sprite("top_right");
}
}

View file

@ -48,5 +48,8 @@ namespace gui {
void render_mind_reading();
void play_hands();
void render_hands();
void show_combat();
void close_combat();
bool hands_playing();
};
}