diff options
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/being.cpp b/src/being.cpp index 570d8b22..4d682ab8 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -362,7 +362,18 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type) if (amount > 0) { - sound.playSfx(mInfo->getSound(SOUND_EVENT_HURT)); + if (mInfo) + { + if (attacker) + { + sound.playSfx(mInfo->getSound(SOUND_EVENT_HURT), + attacker->getTileX(), attacker->getTileY()); + } + else + { + sound.playSfx(mInfo->getSound(SOUND_EVENT_HURT)); + } + } if (getType() == MONSTER) { @@ -394,7 +405,7 @@ void Being::handleAttack(Being *victim, int damage, AttackType type) } sound.playSfx(mInfo->getSound((damage > 0) ? - SOUND_EVENT_HIT : SOUND_EVENT_MISS)); + SOUND_EVENT_HIT : SOUND_EVENT_MISS), mX, mY); } void Being::setName(const std::string &name) @@ -619,7 +630,7 @@ void Being::setAction(Action action, int attackType) break; case DEAD: currentAction = SpriteAction::DEAD; - sound.playSfx(mInfo->getSound(SOUND_EVENT_DIE)); + sound.playSfx(mInfo->getSound(SOUND_EVENT_DIE), mX, mY); break; case STAND: currentAction = SpriteAction::STAND; |