Now the Animation system is no more. Next is cleaning up the quick hacks I needed to finally get rid of it, like animate2::has.

This commit is contained in:
Zed A. Shaw 2026-02-23 23:41:14 -05:00
parent b504afef2a
commit 89ca204f3d
15 changed files with 356 additions and 423 deletions

View file

@ -18,7 +18,7 @@
#include "inventory.hpp"
#include "game_level.hpp"
#include "events.hpp"
#include "animation.hpp"
#include "animate2.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);
animation::animate_entity(world, enemy.entity);
animate2::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<Animation, Temporary>([&](auto ent, auto& anim, auto&) {
world->query<animate2::Animate2, 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<Animation>(ent);
world->remove<animate2::Animate2>(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 = animation::load(effect);
auto anim = animate2::load("assets/animate2.json", effect);
anim.play();
world.set<Animation>(effect_id, anim);
world.set<animate2::Animate2>(effect_id, anim);
drop_item(effect_id);
}