diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2017-07-29 18:45:41 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2017-07-29 18:45:41 -0400 |
commit | 69768fdc5050bbe5877bf80108584400ea292a4f (patch) | |
tree | 6ecca7abf4b30e051deda4b61c4e4bde9bb2150e | |
parent | ec97fe4ab804ae4438ae7eb2c912c78eb3c3c024 (diff) |
attack glow fix
-rw-r--r-- | src/attack.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/attack.cpp b/src/attack.cpp index f585a73..e4b2671 100644 --- a/src/attack.cpp +++ b/src/attack.cpp @@ -45,12 +45,11 @@ void AttackSystem::update(entityx::EntityManager& en, entityx::EventManager& ev, en.each<Health, Position, Solid>([&](entityx::Entity e, Health& health, Position& pos, Solid& dim) { if (!e.has_component<Player>() && inrange(ppos.x, pos.x, pos.x + dim.width) && inrange(ppos.y, pos.y - 2, pos.y + dim.height)) { health.health -= hit.damage; - if (hit.effect.size() == 0) - e.replace<Flash>(Color(255, 0, 0)); - else + e.replace<Flash>(Color(255, 0, 0)); + if (hit.effect.size() > 0) effects.emplace_back(vec2(ppos.x, ppos.y), hit.effect); - ParticleSystem::addMultiple(15, ParticleType::SmallBlast, - [&](){ return vec2(pos.x + dim.width / 2, pos.y + dim.height / 2); }, 300, 7); + //ParticleSystem::addMultiple(15, ParticleType::SmallBlast, + // [&](){ return vec2(pos.x + dim.width / 2, pos.y + dim.height / 2); }, 300, 7); die = !hit.pierce; } else if (WorldSystem::isAboveGround(vec2(ppos.x, ppos.y - 5))) die = true; @@ -74,10 +73,8 @@ void AttackSystem::update(entityx::EntityManager& en, entityx::EventManager& ev, if (inrange(point.x, pos.x, pos.x + dim.width, HLINES(size.x)) && inrange(point.y, pos.y, pos.y + dim.height, HLINES(size.y))) { h.health -= a.attack.power; - - if (a.attack.effect.size() == 0) - e.replace<Flash>(Color(255, 0, 0)); - else + e.replace<Flash>(Color(255, 0, 0)); + if (a.attack.effect.size() > 0) effects.emplace_back(point, a.attack.effect); //ParticleSystem::addMultiple(15, ParticleType::DownSlash, // [&](){ return vec2(pos.x + dim.width / 2, pos.y + dim.height / 2); }, 300, 7); |