aboutsummaryrefslogtreecommitdiffstats
path: root/include/components/health.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/components/health.hpp')
-rw-r--r--include/components/health.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/components/health.hpp b/include/components/health.hpp
index eacaaa5..f0b8e6b 100644
--- a/include/components/health.hpp
+++ b/include/components/health.hpp
@@ -3,6 +3,8 @@
#include "base.hpp"
+#include <SDL2/SDL_mixer.h>
+
/**
* @struct Health
* @brief Gives and entity health and stuff.
@@ -19,6 +21,7 @@ struct Health : public Component {
int health; /**< The current amount of health */
int maxHealth; /**< The maximum amount of health */
+ Mix_Chunk* ouch; /**< Sound made when attacked */
void fromXML(XMLElement* imp, XMLElement* def) final {
(void)imp;
@@ -27,6 +30,11 @@ struct Health : public Component {
if (def->QueryIntAttribute("value", &health) != XML_NO_ERROR)
health = 1;
maxHealth = health;
+ auto o = def->Attribute("ouch");
+ if (o != nullptr)
+ ouch = Mix_LoadWAV(o);
+ else
+ ouch = nullptr;
}
};