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);
|
state(State::PLAYER_TURN);
|
||||||
break;
|
break;
|
||||||
default:
|
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 "animation.hpp"
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include "sound.hpp"
|
||||||
|
|
||||||
namespace boss {
|
namespace boss {
|
||||||
using namespace guecs;
|
using namespace guecs;
|
||||||
|
|
@ -118,9 +119,15 @@ namespace boss {
|
||||||
|
|
||||||
void UI::play_animations(sf::RenderWindow& window) {
|
void UI::play_animations(sf::RenderWindow& window) {
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
auto& sound = $world->get<components::Sound>($boss_id);
|
||||||
|
|
||||||
while($boss_anim.playing) {
|
while($boss_anim.playing) {
|
||||||
animation::apply($boss_anim, *$boss_sprite.sprite, $boss_pos);
|
animation::apply($boss_anim, *$boss_sprite.sprite, $boss_pos);
|
||||||
|
|
||||||
|
if($boss_anim.current == 1 && !sound::playing(sound.attack)) {
|
||||||
|
sound::play(sound.attack);
|
||||||
|
}
|
||||||
|
|
||||||
render(window);
|
render(window);
|
||||||
window.display();
|
window.display();
|
||||||
std::this_thread::sleep_for(16ms);
|
std::this_thread::sleep_for(16ms);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue