Now the animations have sounds and using the rat king boss.

This commit is contained in:
Zed A. Shaw 2025-10-10 02:00:39 -04:00
parent 0930b05fc5
commit ca38b58450
2 changed files with 9 additions and 1 deletions

View file

@ -4,6 +4,7 @@
#include "animation.hpp"
#include <chrono>
#include <thread>
#include "sound.hpp"
namespace boss {
using namespace guecs;
@ -118,9 +119,15 @@ namespace boss {
void UI::play_animations(sf::RenderWindow& window) {
using namespace std::chrono_literals;
auto& sound = $world->get<components::Sound>($boss_id);
while($boss_anim.playing) {
animation::apply($boss_anim, *$boss_sprite.sprite, $boss_pos);
if($boss_anim.current == 1 && !sound::playing(sound.attack)) {
sound::play(sound.attack);
}
render(window);
window.display();
std::this_thread::sleep_for(16ms);