Add sound to swatter

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9542 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-08-17 01:18:24 +00:00
parent 753ef5c351
commit 4112aee9a3
3 changed files with 11 additions and 1 deletions

View File

@ -50,7 +50,7 @@
w-multi=" 0 20 20 20 20 0 0 5 5 0" />
<end33 w=" 0 30 30 30 30 10 20 30 30 30"
w-multi=" 0 30 30 30 30 0 0 20 20 0" />
<last w=" 0 30 30 60 60 0 0 60 60 60"
<last w=" 0 30 30 60 60 0 40 60 60 60"
w-multi=" 0 30 30 60 60 0 0 0 0 0" />
<battle w=" 0 30 60 0 0 10 30 0 0 0"
w-multi=" 0 0 5 0 0 0 0 0 0 0" />

View File

@ -28,6 +28,8 @@
#include "items/swatter.hpp"
#include "audio/music_manager.hpp"
#include "audio/sfx_base.hpp"
#include "audio/sfx_manager.hpp"
#include "items/attachment.hpp"
#include "modes/world.hpp"
#include "karts/kart.hpp"
@ -48,6 +50,8 @@ Swatter::Swatter(Attachment *attachment, Kart *kart)
scene::IAnimatedMeshSceneNode* node = m_attachment->getNode();
node->setPosition(SWAT_POS_OFFSET);
node->setAnimationSpeed(0);
m_swat_sound = sfx_manager->createSoundSource("swatter");
} // Swatter
//-----------------------------------------------------------------------------
@ -179,6 +183,9 @@ void Swatter::squashThingsAround()
assert(swatter_node);
Vec3 swatter_pos = swatter_node->getAbsolutePosition();
m_swat_sound->position(swatter_pos);
m_swat_sound->play();
// Squash karts around
for(unsigned int i=0; i<world->getNumKarts(); i++)
{

View File

@ -31,6 +31,7 @@
class Kart;
class Item;
class Attachment;
class SFXBase;
/**
* \ingroup items
@ -50,6 +51,8 @@ private:
/** The kart the swatter is aiming at. */
Moveable *m_target;
SFXBase *m_swat_sound;
public:
Swatter(Attachment *attachment, Kart *kart);
virtual ~Swatter();