Finally renamed animate2 to animation thus completing the refactor. There's still things to do to make the new animation actually work though.

This commit is contained in:
Zed A. Shaw 2026-02-24 11:36:57 -05:00
parent 83f62e3f45
commit 81a282d544
21 changed files with 83 additions and 339 deletions

View file

@ -18,7 +18,7 @@
#include "inventory.hpp"
#include "game_level.hpp"
#include "events.hpp"
#include "animate2.hpp"
#include "animation.hpp"
using std::string;
using namespace fmt;
@ -279,7 +279,7 @@ void System::combat(int attack_id) {
if(enemy_action == "kill_enemy") {
result.enemy_did = enemy.combat->attack(player_combat);
animate2::animate_entity(world, enemy.entity);
animation::animate_entity(world, enemy.entity);
}
world.send<game::Event>(game::Event::COMBAT, enemy.entity, result);
@ -654,13 +654,13 @@ void System::clear_attack() {
auto world = GameDB::current_world();
std::vector<Entity> dead_anim;
world->query<animate2::Animate2, Temporary>([&](auto ent, auto& anim, auto&) {
world->query<animation::Animation, Temporary>([&](auto ent, auto& anim, auto&) {
if(!anim.playing) dead_anim.push_back(ent);
});
for(auto ent : dead_anim) {
world->remove<Sprite>(ent);
world->remove<animate2::Animate2>(ent);
world->remove<animation::Animation>(ent);
world->remove<SpriteEffect>(ent);
remove_from_world(ent);
}
@ -686,9 +686,9 @@ void System::spawn_attack(World& world, int attack_id, DinkyECS::Entity enemy) {
// also add the same effect to the enemy
world.set<SpriteEffect>(enemy, {50, shader});
auto anim = animate2::load("assets/animate2.json", effect);
auto anim = animation::load("assets/animation.json", effect);
anim.play();
world.set<animate2::Animate2>(effect_id, anim);
world.set<animation::Animation>(effect_id, anim);
drop_item(effect_id);
}