diff --git a/boss/fight.cpp b/boss/fight.cpp index 46bb910..46f5316 100644 --- a/boss/fight.cpp +++ b/boss/fight.cpp @@ -149,10 +149,12 @@ namespace boss { std::string player_move = Random::uniform(0, 1) == 0 ? "player1" : "player3"; $ui.move_actor("player", player_move); if(result.player_did > 0) { - $ui.animate_actor("player"); + $ui.animate_actor("player", "attack"); + $ui.animate_actor("boss", "hurt"); } else { // NO need a no animation event - $ui.animate_actor("player"); + $ui.animate_actor("player", "idle"); + $ui.animate_actor("boss", "idle"); } $ui.damage("player", "boss", result.player_did); } break; @@ -161,16 +163,18 @@ namespace boss { $ui.move_actor("boss", boss_move); if(result.enemy_did > 0) { - $ui.animate_actor("boss"); + $ui.animate_actor("boss", "attack"); + $ui.animate_actor("player", "hurt"); } else { // NO need a no animation event - $ui.animate_actor("boss"); + $ui.animate_actor("boss", "idle"); + $ui.animate_actor("player", "idle"); } $ui.damage("boss", "player", result.enemy_did); } break; case BattleHostState::out_of_ap: // NO need an out of AP animation - $ui.animate_actor("player"); + $ui.animate_actor("player", "idle"); break; } } diff --git a/boss/ui.cpp b/boss/ui.cpp index 77fc8c0..52dd706 100644 --- a/boss/ui.cpp +++ b/boss/ui.cpp @@ -104,8 +104,8 @@ namespace boss { $arena.move_actor(actor, cell_name); } - void UI::animate_actor(const std::string& actor) { - $arena.animate_actor(actor); + void UI::animate_actor(const std::string& actor, const std::string& form) { + $arena.animate_actor(actor, form); } void UI::damage(const string& actor, const std::string& target, int amount) { diff --git a/boss/ui.hpp b/boss/ui.hpp index 1cd615d..6c5d895 100644 --- a/boss/ui.hpp +++ b/boss/ui.hpp @@ -35,7 +35,7 @@ namespace boss { bool mouse(float x, float y, guecs::Modifiers mods); void status(const std::wstring& msg, const std::wstring &button_msg); void move_actor(const std::string& actor, const std::string& cell_name); - void animate_actor(const std::string& actor); + void animate_actor(const std::string& actor, const std::string& form); void update_stats(); void damage(const std::string& actor, const std::string& target, int amount); void reset_camera(); diff --git a/scene.cpp b/scene.cpp index 8c4e8d0..d8ae5fe 100644 --- a/scene.cpp +++ b/scene.cpp @@ -120,9 +120,13 @@ namespace scene { config.pos = position_sprite(config.st, config.cell, config.scale, config.at_mid); } - void Engine::animate_actor(const std::string& actor) { + void Engine::animate_actor(const std::string& actor, const std::string& form) { auto& config = actor_config(actor); - if(!config.anim.playing) config.anim.play(); + + if(!config.anim.playing) { + config.anim.play(); + config.anim.set_form(form); + } } inline void this_is_stupid_refactor(std::vector& elements) { diff --git a/scene.hpp b/scene.hpp index 9bfd281..54bb555 100644 --- a/scene.hpp +++ b/scene.hpp @@ -47,7 +47,7 @@ namespace scene { sf::Vector2f position_sprite(textures::SpriteTexture& st, const std::string& cell_name, sf::Vector2f scale, bool at_mid, float x_diff=0.0f, float y_diff=0.0f); void move_actor(const std::string& actor, const std::string& cell_name); - void animate_actor(const std::string& actor); + void animate_actor(const std::string& actor, const std::string& form); void play_animations(); void apply_effect(const std::string& actor, const std::string& shader); Element& actor_config(const std::string& actor);