From 51975cd8624fff3b20aa3b7b1932555e32786561 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 3 Apr 2011 20:10:33 +0300 Subject: Add spawn animation to mobs. Also impliment sound events: SOUND_EVENT_MOVE, SOUND_EVENT_SIT, SOUND_EVENT_SPAWN --- src/being.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/being.cpp') diff --git a/src/being.cpp b/src/being.cpp index 2e2c68283..a18f28ae3 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -865,6 +865,8 @@ void Being::setAction(Action action, int attackType _UNUSED_) switch (action) { case MOVE: + if (mInfo) + sound.playSfx(mInfo->getSound(SOUND_EVENT_MOVE), mX, mY); currentAction = SpriteAction::MOVE; // Note: When adding a run action, // Differentiate walk and run with action name, @@ -872,6 +874,8 @@ void Being::setAction(Action action, int attackType _UNUSED_) break; case SIT: currentAction = SpriteAction::SIT; + if (mInfo) + sound.playSfx(mInfo->getSound(SOUND_EVENT_SIT), mX, mY); break; case ATTACK: if (mEquippedWeapon) @@ -919,6 +923,8 @@ void Being::setAction(Action action, int attackType _UNUSED_) break; case HURT: + if (mInfo) + sound.playSfx(mInfo->getSound(SOUND_EVENT_HURT), mX, mY); //currentAction = SpriteAction::HURT;// Buggy: makes the player stop // attacking and unable to attack // again until he moves. @@ -932,6 +938,11 @@ void Being::setAction(Action action, int attackType _UNUSED_) case STAND: currentAction = SpriteAction::STAND; break; + case SPAWN: + if (mInfo) + sound.playSfx(mInfo->getSound(SOUND_EVENT_SPAWN), mX, mY); + currentAction = SpriteAction::SPAWN; + break; default: logger->log("Being::setAction unknown action: " + toString(static_cast(action))); -- cgit v1.2.3-60-g2f50