From 3ef0e74749373d4cfa2a9f8cda9b536b77d8b4cd Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Thu, 26 Oct 2017 15:54:44 -0400 Subject: fight stuff --- src/attack.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/attack.cpp') diff --git a/src/attack.cpp b/src/attack.cpp index cf2f627..41fb77c 100644 --- a/src/attack.cpp +++ b/src/attack.cpp @@ -51,7 +51,10 @@ namespace lua { int damage(lua_State* state) { float d = lua_tonumber(state, 1); - entity->component()->health -= d; + auto h = entity->component(); + h->health -= d; + if (h->ouch != nullptr) + Mix_PlayChannel(0, h->ouch, 0); return 0; } } -- cgit v1.2.3