Everyone has different animations, but they tend to cancel each other out. Need to refine it next.
This commit is contained in:
parent
458bf7e25e
commit
ba91929bfd
5 changed files with 19 additions and 11 deletions
|
|
@ -149,10 +149,12 @@ namespace boss {
|
||||||
std::string player_move = Random::uniform(0, 1) == 0 ? "player1" : "player3";
|
std::string player_move = Random::uniform(0, 1) == 0 ? "player1" : "player3";
|
||||||
$ui.move_actor("player", player_move);
|
$ui.move_actor("player", player_move);
|
||||||
if(result.player_did > 0) {
|
if(result.player_did > 0) {
|
||||||
$ui.animate_actor("player");
|
$ui.animate_actor("player", "attack");
|
||||||
|
$ui.animate_actor("boss", "hurt");
|
||||||
} else {
|
} else {
|
||||||
// NO need a no animation event
|
// 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);
|
$ui.damage("player", "boss", result.player_did);
|
||||||
} break;
|
} break;
|
||||||
|
|
@ -161,16 +163,18 @@ namespace boss {
|
||||||
|
|
||||||
$ui.move_actor("boss", boss_move);
|
$ui.move_actor("boss", boss_move);
|
||||||
if(result.enemy_did > 0) {
|
if(result.enemy_did > 0) {
|
||||||
$ui.animate_actor("boss");
|
$ui.animate_actor("boss", "attack");
|
||||||
|
$ui.animate_actor("player", "hurt");
|
||||||
} else {
|
} else {
|
||||||
// NO need a no animation event
|
// 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);
|
$ui.damage("boss", "player", result.enemy_did);
|
||||||
} break;
|
} break;
|
||||||
case BattleHostState::out_of_ap:
|
case BattleHostState::out_of_ap:
|
||||||
// NO need an out of AP animation
|
// NO need an out of AP animation
|
||||||
$ui.animate_actor("player");
|
$ui.animate_actor("player", "idle");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,8 @@ namespace boss {
|
||||||
$arena.move_actor(actor, cell_name);
|
$arena.move_actor(actor, cell_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI::animate_actor(const std::string& actor) {
|
void UI::animate_actor(const std::string& actor, const std::string& form) {
|
||||||
$arena.animate_actor(actor);
|
$arena.animate_actor(actor, form);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI::damage(const string& actor, const std::string& target, int amount) {
|
void UI::damage(const string& actor, const std::string& target, int amount) {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ namespace boss {
|
||||||
bool mouse(float x, float y, guecs::Modifiers mods);
|
bool mouse(float x, float y, guecs::Modifiers mods);
|
||||||
void status(const std::wstring& msg, const std::wstring &button_msg);
|
void status(const std::wstring& msg, const std::wstring &button_msg);
|
||||||
void move_actor(const std::string& actor, const std::string& cell_name);
|
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 update_stats();
|
||||||
void damage(const std::string& actor, const std::string& target, int amount);
|
void damage(const std::string& actor, const std::string& target, int amount);
|
||||||
void reset_camera();
|
void reset_camera();
|
||||||
|
|
|
||||||
|
|
@ -120,9 +120,13 @@ namespace scene {
|
||||||
config.pos = position_sprite(config.st, config.cell, config.scale, config.at_mid);
|
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);
|
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<Element>& elements) {
|
inline void this_is_stupid_refactor(std::vector<Element>& elements) {
|
||||||
|
|
|
||||||
|
|
@ -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);
|
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 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 play_animations();
|
||||||
void apply_effect(const std::string& actor, const std::string& shader);
|
void apply_effect(const std::string& actor, const std::string& shader);
|
||||||
Element& actor_config(const std::string& actor);
|
Element& actor_config(const std::string& actor);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue