aboutsummaryrefslogtreecommitdiffstats
path: root/src/attack.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2017-10-26 15:54:44 -0400
committerClyne Sullivan <tullivan99@gmail.com>2017-10-26 15:54:44 -0400
commit3ef0e74749373d4cfa2a9f8cda9b536b77d8b4cd (patch)
treece5d7d350aab71114024d6add712df38928e2004 /src/attack.cpp
parentf785f17cdb286449e8d98be747213740172629c5 (diff)
fight stuff
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;
}
}