summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-04-03 20:10:33 +0300
committerAndrei Karas <akaras@inbox.ru>2011-04-03 20:10:33 +0300
commit51975cd8624fff3b20aa3b7b1932555e32786561 (patch)
tree55ff8d9c5a459bada8038807a1eaf0dfe98945e2 /src/being.cpp
parentfd16292e758ab6fc910ed07441e6e477d616201c (diff)
downloadplus-51975cd8624fff3b20aa3b7b1932555e32786561.tar.gz
plus-51975cd8624fff3b20aa3b7b1932555e32786561.tar.bz2
plus-51975cd8624fff3b20aa3b7b1932555e32786561.tar.xz
plus-51975cd8624fff3b20aa3b7b1932555e32786561.zip
Add spawn animation to mobs.
Also impliment sound events: SOUND_EVENT_MOVE, SOUND_EVENT_SIT, SOUND_EVENT_SPAWN
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp11
1 files changed, 11 insertions, 0 deletions
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<unsigned>(action)));