Now the animations have sounds and using the rat king boss.
This commit is contained in:
parent
0930b05fc5
commit
ca38b58450
2 changed files with 9 additions and 1 deletions
|
|
@ -69,7 +69,8 @@ namespace boss {
|
|||
state(State::PLAYER_TURN);
|
||||
break;
|
||||
default:
|
||||
fmt::println("BOSS_FIGHT unknown event {}", (int)ev);
|
||||
// fmt::println("BOSS_FIGHT unknown event {}", (int)ev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue