bring back the shaders on the enemies too to show they got hit.

This commit is contained in:
Zed A. Shaw 2025-09-15 14:02:07 -04:00
parent d1f7337de4
commit 47f659ae8e
2 changed files with 6 additions and 3 deletions

View file

@ -265,7 +265,7 @@ void System::combat(int attack_id) {
}; };
if(result.player_did > 0) { if(result.player_did > 0) {
spawn_attack(world, attack_id); spawn_attack(world, attack_id, enemy.entity);
} }
if(enemy_action == combat::BattleAction::ATTACK) { if(enemy_action == combat::BattleAction::ATTACK) {
@ -660,7 +660,7 @@ void System::clear_attack() {
} }
} }
void System::spawn_attack(World& world, int attack_id) { void System::spawn_attack(World& world, int attack_id, DinkyECS::Entity enemy) {
using enum ritual::Element; // for FIRE vs LIGHTNING using enum ritual::Element; // for FIRE vs LIGHTNING
auto& the_belt = world.get_the<ritual::Belt>(); auto& the_belt = world.get_the<ritual::Belt>();
@ -677,6 +677,9 @@ void System::spawn_attack(World& world, int attack_id) {
auto shader = shaders::get(ritual.element == FIRE ? "flame" : "lightning"); auto shader = shaders::get(ritual.element == FIRE ? "flame" : "lightning");
world.set<SpriteEffect>(effect_id, {100, shader}); world.set<SpriteEffect>(effect_id, {100, shader});
// also add the same effect to the enemy
world.set<SpriteEffect>(enemy, {50, shader});
auto anim = animation::load(effect); auto anim = animation::load(effect);
anim.play(); anim.play();
world.set<Animation>(effect_id, anim); world.set<Animation>(effect_id, anim);

View file

@ -73,5 +73,5 @@ namespace System {
} }
void clear_attack(); void clear_attack();
void spawn_attack(World& world, int attack_id); void spawn_attack(World& world, int attack_id, DinkyECS::Entity enemy);
} }