aboutsummaryrefslogtreecommitdiffstats
path: root/src/player.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2017-03-28 11:21:33 -0400
committerClyne Sullivan <tullivan99@gmail.com>2017-03-28 11:21:33 -0400
commit00f879600bcea8f1ec1775c941041ee6346a60ba (patch)
treef9bb9ca811a2a565aed16ccab31cc2847539072f /src/player.cpp
parentceef5de7d838e97c3d7f990023398181ee1500c2 (diff)
skirl can kill
Diffstat (limited to 'src/player.cpp')
-rw-r--r--src/player.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/player.cpp b/src/player.cpp
index 711ddae..204b7f0 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -105,6 +105,9 @@ void PlayerSystem::update(entityx::EntityManager &en, entityx::EventManager &ev,
(void)ev;
(void)dt;
+ if (player.component<Health>()->health <= 0)
+ abort();
+
auto& vel = *player.component<Direction>().get();
if (moveLeft & !moveRight)
@@ -221,7 +224,7 @@ void PlayerSystem::receive(const UseItemEvent& uie)
auto loc = getPosition();
auto &solid = *player.component<Solid>().get();
loc.x += solid.width / 2, loc.y += solid.height / 2;
- game::events.emit<AttackEvent>(loc, AttackType::ShortSlash);
+ game::events.emit<AttackEvent>(loc, AttackType::ShortSlash, true);
} else if (uie.item->type == "Bow") {
if (game::engine.getSystem<InventorySystem>()->take("Arrow", 1)) {
auto e = game::entities.create();
@@ -238,7 +241,7 @@ void PlayerSystem::receive(const UseItemEvent& uie)
sprite->addSpriteSegment(SpriteData(tex.sprite), 0);
auto dim = HLINES(sprite->getSpriteSize());
e.assign<Solid>(dim.x, dim.y);
- e.assign<Hit>(10);
+ e.assign<Hit>(10, false);
}
}