aboutsummaryrefslogtreecommitdiffstats
path: root/src/attack.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/attack.cpp')
-rw-r--r--src/attack.cpp5
1 files changed, 4 insertions, 1 deletions
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>()->health -= d;
+ auto h = entity->component<Health>();
+ h->health -= d;
+ if (h->ouch != nullptr)
+ Mix_PlayChannel(0, h->ouch, 0);
return 0;
}
}